wood burning stoves 2.0*
The moose likes Object Relational Mapping and the fly likes difference between <component> and <one-to-one> element in hibernate Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "difference between <component> and <one-to-one> element in hibernate" Watch "difference between <component> and <one-to-one> element in hibernate" New topic
Author

difference between <component> and <one-to-one> element in hibernate

Brendon Woodford
Ranch Hand

Joined: Jan 22, 2010
Posts: 53
hi all,
what is the difference between <component> and <one-to-one> element in hibernate
thanks to all
Mujahed Syed
Ranch Hand

Joined: May 18, 2010
Posts: 32

I guess difference is the key attribute. In component there isn't any key.


SCJP, OCWCD
Adam Paul ii
Greenhorn

Joined: Apr 30, 2012
Posts: 2
Hi Brandon.

I had this question once too.
O2O entity have Its own identity

As Mujahed said In component there isn't any key. A component has no identity of its own i.e PK .


Both of them have same kind of relation but their implementation depends on the Application design

I wrote a post on Component mapping here http://akash.thegrassroots.co.in/hibernate-4-x-component-mapping-tutorial-3/

Regards
Akash
Ankit Dan
Ranch Hand

Joined: Aug 31, 2012
Posts: 47

Java itself has no concept of composition—a class or attribute can’t be marked as a component or composition. The only difference is the object identifier: A component has no identity, hence the persistent component class requires no identifier property or identifier mapping.
Hibernate uses the term component for a user-defined class that is persisted to the same table as the owning entity, that is not the case in one-to-one mapping

Hope this helps
Ankit
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: difference between <component> and <one-to-one> element in hibernate
 
Similar Threads
Collection of components
difference between hibernate and IBates
Java components
diff object vs component
Component and Object