Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Agile forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

diff between MappedSuperClass and Embeddable class

 
Senthil Kumar
Ranch Hand
Posts: 264
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can someone explain the differences between the mapped class and embeddable class
[ August 30, 2007: Message edited by: Senthil Kumar SS ]
 
Benoît de Chateauvieux
Ranch Hand
Posts: 183
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Satya Maheshwari
Ranch Hand
Posts: 368
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic