Forums Register Login

diff between MappedSuperClass and Embeddable class

+Pie Number of slices to send: Send
can someone explain the differences between the mapped class and embeddable class
[ August 30, 2007: Message edited by: Senthil Kumar SS ]
+Pie Number of slices to send: Send
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.
+Pie Number of slices to send: Send
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.

 
When people don’t understand what you are doing they call you crazy. But this tiny ad just doesn't care:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 5237 times.
Similar Threads
What are the difference between Embeddable and One-to-one relationship.
(JPA) questions about embeddable class
Collection of Entities in an Embeddable?
Composite key classes
@EmbeddedId / equals() / hashCode()
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 29, 2024 08:19:07.