Reputation: 125
I am curious, what ways there are, to fill database-tables using hibernate.
I am a Java EE beginner and only know two ways:
If there are many other ways, please mention the benefits of using them.
Thank you in advance!
Upvotes: 1
Views: 1163
Reputation: 6540
You've pretty much covered the two main methods used, so I'll give you the pro's and cons of each.
Method 1: Getting Hibernate to generate SQL to create tables based on Object Definitions:
Pros
Cons
Method 2: Generating your schema with written SQL:
Pros
Cons
ConstraintViolationException
's.I hope that's given you some idea of how these can be used and in what circumstances. If anyone feels I've missed things out, feel free to comment.
Upvotes: 2