• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JPA Embeddable and MappedSuperclass

 
Fredrik Liden
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can an entity be both Embeddable and MappedSuperclass at the same time?

In one place of the model it's used as an embeddable but in another place it needs to be inherited from.
 
xsunil kumar
Ranch Hand
Posts: 143
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, you can define any entity which is Embedded and MappedSuperclass at the same time. Below is the syntax to use this.

@Embeddable
@MappedSuperclass
public class AddressEmbedded implements Serializable{
// properties values and their getter/ setter methods.
}

-Sunil
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic