-->

hibernate reverse engineering in Netbeans cannot f

2019-05-05 17:24发布

问题:

I have a Test SQL Server database installed on my machine. Created a test SQL Server account and two tables were created with this account in TestDb on the default schema. On my Java Web app (simple JSP) I am using Hibernate and configured it to point to the test database. However when I get to create the hibernate.reveng file the wizard does not find/display any available tables. Please see my hibernate config file:

<hibernate-configuration>
  <session-factory>
    <property name="hibernate.connection.driver_class">com.microsoft.sqlserver.jdbc.SQLServerDriver</property>
    <property name="hibernate.connection.url">jdbc:sqlserver://localhost:1433;databaseName=TestDb;</property>
    <property name="hibernate.connection.username">test</property>
    <property name="hibernate.connection.password">password</property>
    <property name="hibernate.dialect">org.hibernate.dialect.SQLServerDialect</property>
  </session-factory>
</hibernate-configuration>

There is no error when going to the step where I am supposed to see tables. It just doesn't display anything in the two Database Tables boxes. I can even save the xml file without any warnings/errors, but there is no table inside. I need some help with the current setup so I can display and map tables through the hibernate wizard.

回答1:

Just add MySql JDBC Library file into library, it worked for me.



回答2:

I am having the same problem, i found this that explains how to get around the reverse engineering wizard. Its an alternate option near the end of the article -

http://netbeans.org/kb/docs/java/hibernate-java-se.html#10



回答3:

Figured out where the problem was. When you create a new login in management studio, you can see in one of the options which schema the user is using. You need to select that specific schema when creating the hibernate reveng file. I can post further details if anyone still have the same problem.



回答4:

You should to write,

Integrated Security=true;

new hibernate.connection.url -->

jdbc:sqlserver://localhost:1433;databaseName=TestDb;Integrated Security=true;