Luigi Cortese
Luigi Cortese

Reputation: 11141

JPA project in Eclipse: how to auto-generate entity classes from DB tables

I have a JPA project deployed on JBoss7 in Eclipse Luna (4.4.1).

I've defined a datasource in the server and referenced it in my persistence.xml file:

<jta-data-source>java:/testdb</jta-data-source>

I've created an entity bean from scratch and everything works great. But... is there any Eclipse tool, external plugin or else that connects to the database, reads the table and autogenerates such entities?

I managed to do that by using a local JDBC connection, but now I can't find a way to do that with a jta datasource.

Upvotes: 1

Views: 5988

Answers (1)

riddle_me_this
riddle_me_this

Reputation: 9155

I don't see any mention of Hibernate in your post, but you can have a look at Hibernate Tools to reverse engineer your POJOs. It should do just that.

From the docs:

The most powerful feature of Hibernate Tools is a database reverse engineering tool that can generate domain model classes and Hibernate mapping files, annotated EJB3 entity beans, HTML documentation or even an entire JBoss Seam application in seconds!

Upvotes: 2

Related Questions