i’m fairly new to Java and Hibernate. At work we are developing a medium sized, formprocessing J2EE web application using Spring, Hibernate, JBOSS and so on. What is the correct approach using Hibernate? Should i create first a class diagram and the map it using hibernate to DB Tables or should i first model the DB Tables and then map it to Hibernate Entities? Or does it depend? If it depends than on what? Has either of this approaches drawbacks against the other? Is it possible to map “any” class diagram to a DB using Hibernate 4?
Share
Both approaches are correct, but used in different situations.
But I repeat, both approaches are valid, if you are more DB engineer than Java programmer, you wold probably do 2) because it might be more natural to you. I as a Java programmar do (almost) always 1)…
You can the same results with both approaches and in both you have to think about, what will hibernate generate for you…