I am having tables created by a DBA and I intend to have entity classes for each table for further querying. Can any one suggest how to automatically create the entity classes using Eclipse?
-
1Hibernate tools (part of JBoss Tools) can autogenerate entities from a database schema. Don't ask me how to use it though, I only managed to make it work through seam-gen which is part of the Seam 2 framework.Gimby– Gimby2013-01-03 14:14:31 +00:00Commented Jan 3, 2013 at 14:14
3 Answers
If you use JPA for persistence, you can use "JPA tools" provided by Eclipse to generate java entity class from tables.
Here is the [tutorial][1]
[1]: http://shengwangi.blogspot.com/2014/12/how-to-create-java-classes-from-tables.html on my personal website.
2 Comments
You can generate classes using Hibernate Tools. There are two ways to generate these classes which is called as Reverse Engineering and Code Generation[dead link] -
- You can use Hibernate Tools Eclipse Plugin.
- You can write Ant Script using Hibernate tools jar.
Comments
You can try the Telosys code generator. It can help for this kind of job.
It allows to generate the Java (POJO) classes from any database with the basic templates and you can also create your own template (a Velocity file) to generate your DAO classes
For more information see https://www.telosys.org