Environment
- Ubuntu 12.04 LTS
- Eclipse Juno 4.2 Build id: 20120614-1722
- GWT SDK - 2.4.0
- App Engine SDK - 1.7.2
- Hibernate Version 3.5
- JRE: java-7-openjdk-amd64
In reference to @mael comment, Hibernate Tools was installed from the following Eclipse repo: http://download.jboss.org/jbosstools/updates/stable/indigo/
Problem
The project is a GWT Web Application that uses Hibernate as the entity/persistence manager. I have successfully configured Hibernate to connect to the database, and it pulls in all the tables and associated columns I am interested in. I use Hibernate to reverse engineer the entity/persistence classes; it runs successfully, but I get the import errors in the newly generated classes:
- The import org.hibernate.LockMode cannot be resolved.
- The import org.hibernate.SessionFactory cannot be resolved.
- The import org.hibernate.criterion.Example cannot be resolved.
Research/Troubleshooting
There was similar problem I found here. I performed the search for the aforementioned classes, and did not find them. I then readded java-7-openjdk-amd64 JRE under Windows > Preferences > Installed JREs. This did not resolve the problem.
Also, there does not seem to be very much out there for this problem. So I am assuming there is something I have not understood in the setup of Hibernate and reverse engineering.
Another Similar Problem - Same Solution
Update: Solution
- Following @mael's solution, I confirmed that Hibernate Tools does not automatically include the Hibernate jar files required for the auto-generated entity/persistence classes.
- Downloaded the Hibernate4 jar files from the following location.
- Extracted files to the Eclipse workspace.
- In Eclipse, right-click on {Project} and go to Build Path > Configure Build Path... > Java Build Path.
- Click on the Libraries tab.
- Click on Add External JARs...
- Go to directory where Hibernate4 JAR files were extracted, and follow the path to lib > required.
- Select all JAR files in the folder and confirm.