This is a tough one.. I started learning Java EE recently and came across this problem - when i run the Hibernate Reverse Engineering Wizard from NetBeans,开发者_JAVA技巧 it says, that it is connecting to the database, then checking the schema, but after that, there are no available tables in the dialog - it is empty, but no error messages.
After googling, I checked a 3rd party driver/dialect from HXTT, it gave no results too, I even tried the Microsoft SQL Server dialect and driver, with an error in hibernate.cfg.
The configuration looks like this:
<property name="hibernate.dialect">org.hibernate.dialect.SQLServerDialect</property>
<property name="hibernate.connection.driver_class">sun.jdbc.odbc.JdbcOdbcDriver</property>
<property name="hibernate.connection.url">jdbc:odbc:Driver={Microsoft Access Driver (*.mdb, *.accdb)};DBQ=D:/Path is correct</property>
The path is correct, I can do every possible thing with JDBC, I doubt there are security restrictions. After the wizard completes, the reveng.xml file has only this line:
<schema-selection match-catalog="Path to DB"/>
If there really isn't hope for Access + Hibernate, I would love to know a possibility of using it anyway in a web app, for example with JDBC.
Access 2007 doesn't seem to be supported. Check this page for compatibility.
I was struck with this issue for 3 days and now, found the reason why this could occur.
Step 1
In Netbeans IDE, Click on Window - Services. Now choose the database connection you created and click "Connect".
To validate if this connection is good.
Right click on the connection name and click on Execute Command. Now, wite a simple select query on any table in database. It should give proper results.
If you face error here, delete the connection. Create a new Driver name based on the database driver file and create a new connection to the database.
Remember that, SQL Server default port is 1433.
Important- The default scheme you select while creating this connection should be "DBO"
Step 2
In your application, add the hibernate.cfg file using the netbeans wizard (Others - Hibernate.cfg) file
Once config file is added, add the reverse engineering wizard by selecting the appropriate config file.
You will be seeing the list of available tables.
精彩评论