This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes diff between MappedSuperClass and Embeddable class 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 » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "diff between MappedSuperClass and Embeddable class" Watch "diff between MappedSuperClass and Embeddable class" New topic
Author

diff between MappedSuperClass and Embeddable class

Senthil Kumar
Ranch Hand

Joined: Mar 13, 2006
Posts: 264
can someone explain the differences between the mapped class and embeddable class
[ August 30, 2007: Message edited by: Senthil Kumar SS ]

when you really want something, all the universe always conspires in your favour.<br /> <br />SCJP1.5-77%<br />SCWCD-89%
Benoît de Chateauvieux
Ranch Hand

Joined: Aug 10, 2007
Posts: 183
You can use a MappedSuperClass between 2 Entities in an entities hierarchy.
All the subclasses of a MappedSuperClass will inherit the persistent properties of the MappedSuperClass.

Embedded classes can be used in classes of distinct hierarchies.

Hope it helps.


SCJP5 | SCBCD5 | SCEA5 Part 1
Satya Maheshwari
Ranch Hand

Joined: Jan 01, 2007
Posts: 368
Quoting from Spec. 2.1.9.2

Mapped Superclasses:
An entity may inherit from a superclass that provides persistent entity state and mapping information,but which is not itself an entity. Typically, the purpose of such a mapped superclass is to define state and mapping information that is common to multiple entity classes.


Quoting from Spec.2.1.5
Embeddable Classes
An entity may use other fine-grained classes to represent entity state. Instances of these classes, unlike entity instances themselves, do not have persistent identity. Instead, they exist only as embedded objects of the entity to which they belong. Such embedded objects belong strictly to their owning entity, and are not sharable across persistent entities.


Thanks and Regards
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: diff between MappedSuperClass and Embeddable class
 
Similar Threads
Collection of Entities in an Embeddable?
Composite key classes
What are the difference between Embeddable and One-to-one relationship.
(JPA) questions about embeddable class
@EmbeddedId / equals() / hashCode()