• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Hibernate Exporting

 
James Collings
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So I'm on this Hibernate based project. We have folks who are for ORM and folks who are against it. The problem as I perceive it is that we are trying to develop from both ends. SQL in the database on one side and Annotated Entities on the other. The two sides aren't connecting when it comes to debugging stuff.

So here is my question: I believe that there is a method by which we can let the folks who want to develop from the database side do so and then export from a JDBC connection to the annotated entities. It's an Ant target, isn't it?

From the other side, there must be a way to generate SQL from annotated entities, so that the Java side can see how their work will look in SQL.

For the RTFM boys, I'll be reading a book on this over the weekend but I'll still take what ever advice I can get. ;-)
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

So here is my question: I believe that there is a method by which we can let the folks who want to develop from the database side do so and then export from a JDBC connection to the annotated entities. It's an Ant target, isn't it?

From the other side, there must be a way to generate SQL from annotated entities, so that the Java side can see how their work will look in SQL.

There are both. Hibernate tools has database reverse engineering capabilities and Hibernate itself has a property to generate DDL at startup (see the configuration documentation).

This aside, my preference is always to let the data modeller define their model first. I would do this because it is easy to follow some Hibernate recommenations, or use Hibernate generation tools, and end up with a "Hibernate-flavoured" data model. Some of the stuff Hibernate recommends are what I would consider bad data modelling (the table per class hierarchy pattern for example).

Its an impossible ideal to have a seamless ORM translation; there will always be compromises. I would rather see the data kept valid using proper constraints and the like and work round any mapping issues in the DAO layer.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic