Netbeans 中的 hibernate 逆向工程找不到 SQL Server 表
我的机器上安装了测试 SQL Server 数据库。 创建了一个测试 SQL Server 帐户,并使用该帐户在 TestDb 中的默认架构上创建了两个表。 在我的 Java Web 应用程序(简单的 JSP)上,我使用 Hibernate 并将其配置为指向测试数据库。 但是,当我创建 hibernate.reveng 文件时,向导没有找到/显示任何可用的表。 请查看我的休眠配置文件:
<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>
转到我应该查看表格的步骤时没有错误。它只是在两个数据库表框中不显示任何内容。 我什至可以保存 xml 文件而没有任何警告/错误,但里面没有表。 我需要一些有关当前设置的帮助,以便我可以通过休眠向导显示和映射表。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
只需将 MySql JDBC 库文件添加到库中,它对我有用。
Just add MySql JDBC Library file into library, it worked for me.
我遇到了同样的问题,我发现这解释了如何绕过逆向工程向导。它是文章末尾附近的替代选项 -
http:// netbeans.org/kb/docs/java/hibernate-java-se.html#10
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
弄清楚问题出在哪里了。当您在 Management Studio 中创建新登录时,您可以在选项之一中查看用户正在使用的架构。您需要在创建 hibernate reveng 文件时选择该特定架构。如果有人仍然遇到同样的问题,我可以发布更多详细信息。
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.
你应该写,
新的 hibernate.connection.url -->
You should to write,
new hibernate.connection.url -->