Ion Moraru
Ion Moraru

Reputation: 41

hibernate reverse engineering in Netbeans cannot find SQL Server tables

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.

Upvotes: 4

Views: 4865

Answers (4)

Ishan
Ishan

Reputation: 720

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

Upvotes: 1

cengiz
cengiz

Reputation: 101

You should to write,

Integrated Security=true;

new hibernate.connection.url -->

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

Upvotes: 0

Lenymm
Lenymm

Reputation: 901

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.

Upvotes: 0

BilliD
BilliD

Reputation: 617

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

Upvotes: 0

Related Questions