hibernate reverse engineering in Netbeans cannot find SQL Server tables

橙三吉。 提交于 2019-12-10 07:00:55

问题


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;



来源:https://stackoverflow.com/questions/7861351/hibernate-reverse-engineering-in-netbeans-cannot-find-sql-server-tables

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!