File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Object Relational Mapping and the fly likes Database Schema Query Using Hibernate Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Head First Android this week in the Android forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Database Schema Query Using Hibernate" Watch "Database Schema Query Using Hibernate" New topic

Database Schema Query Using Hibernate

Vaibhav G Garg
Ranch Hand

Joined: Sep 23, 2011
Posts: 140
Hi All,

I am pretty new to Hibernate framework. While reading through the various features provided by Hibernate like associations, inheritance, etc I found that it is required to change the database schema as well. Below are a couple of instances:

i. If we are using List to store a collection, then we need to add an index column to the database to store the order of insertion.

ii. If we are implementing inheritance, then it is required to create a new table to store the relationship or add a discriminator column in the same table.

iii. In case of relationships, if an entity has a collection of other objects, then that collection would be stored in a separate table. How would we be able to handle such scenarios where entity can have multiple collections.

These are a few of the instances I have encountered which needs database schema changes. I have the following queries:

i. Please let me know if my understanding is correct and it is required to update the db schema in these cases.

ii. Does this mean that we wouldn't be able to use the Hibernate if we don't have access to update the db schmea?

iii. If we have to change the schema a lot like adding indexes or creating new table to hold relationships, won't it be tightly coupled information related to hibernate?

iv. Is Hibernate benefits really outweigh the changes made by us to the db schema? What are the benefits of using hibernate if we are required to put in so much effort in changing the db schema?

Thanks in Advance!

Vaibhav G
Vaibhav G Garg
Ranch Hand

Joined: Sep 23, 2011
Posts: 140
Please suggest your inputs.
Vaibhav G Garg
Ranch Hand

Joined: Sep 23, 2011
Posts: 140
Please provide your inputs.
I agree. Here's the link:
subject: Database Schema Query Using Hibernate
jQuery in Action, 3rd edition