hibernate reverse engineering in Netbeans cannot f

2019-05-05 17:38发布

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.

4条回答
【Aperson】
2楼-- · 2019-05-05 18:05

You should to write,

Integrated Security=true;

new hibernate.connection.url -->

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

查看更多
乱世女痞
3楼-- · 2019-05-05 18:13

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

查看更多
做个烂人
4楼-- · 2019-05-05 18:18

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.

查看更多
相关推荐>>
5楼-- · 2019-05-05 18:23

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

查看更多
登录 后发表回答