Questions tagged [mappedsuperclass]

Annotation for a class that entity classes inherit from

Annotation for a class that entity classes inherit from. The mapped super class is annotated with a specific @annotation and does not exist in the database as a table. Typically, the purpose of such a mapped super class is to define state and mapping information that is common to multiple entity classes.

The concept of mapped super classes is for example used in:

105 questions
0
votes
0 answers

Why is hibernate saying class doesn't have an id when testing an extended entity?

I am trying to set up an h2 database for testing. Problem is that when I try to run a test I get an error: ids for this class must be manually assigned before calling save() even though the super class has the id. Is this just a bad entity design…
aratata
  • 1,147
  • 1
  • 6
  • 22
0
votes
1 answer

Getting An Instance Of A Mapped Superclass With Hibernate EntityManager

I'm having some issues dealing with a Mapped Superclass in Hibernate. I have two applications, Product and Manufacturer that share a Common library but otherwise do not have any direct dependencies on each other. The Common lib has an abstract…
pbuchheit
  • 1,371
  • 1
  • 20
  • 47
0
votes
1 answer

MappedSuperclass - Change SequenceGenerator in Subclass without @GeneratedValue on the Superclass

I have a base class: @MappedSuperclass public abstract class SuperClass{ @Id protected Long id; public Long getId() { return id; } } The @GeneratedValue is not used since the id is generated using a BackendSession There are…
0
votes
1 answer

Doctrine - OneToOne relationship not working with extends MappedSuperclass

I try to use @MappedSuperclass. It works well for simple variable (int, string...) and OneToMany/ManyToOne relationship. But OneToOne relationship doesn't work. I have two MappedSuperclass with OneToOne relationship : _SiteUser /** *…
MatDepInfo
  • 317
  • 3
  • 16
0
votes
0 answers

MappedSuperclass maps all child entities to one child

I have the TranslationBase base abstract class, and tow subclasses[entities] : CountryTranslation and RegionTranslation as shown below : TranslationBase: @MappedSuperclass @IdClass(TranslationBasePK.class) public abstract class TranslationBase
0
votes
0 answers

JPA 2.1 and Hibernate with multiple MappedSuperclass

I dont know if this a error or a normal feature, but my MappedSuperclass properties arent reconized by JPA/hibernate after I use a multi hierarchy. I have those classes: @MappedSuperclass public abstract class AbstractDomain{ private Integer…
LottaLava
  • 889
  • 1
  • 9
  • 21
0
votes
0 answers

how do i set up a one to one with superclass in kotlin

I have different user types Author and Commentor. I wanted them to have a OneToOne relationship with my User class. The user class would contain spring security logic. I created a super class of BlogUser and my Author and Commenter would extend…
Chris Legge
  • 739
  • 2
  • 9
  • 24
0
votes
1 answer

JPA @MappedSuperclass No identifier specified for entity

I'm using Spring-Boot 1.5.10 with spring-boot-starter-data-jpa. I have a staging table and a production table, both have the same structure just different table names. Columns are: compKey1 compKey2 compKey3 col_A col_B col_c I am getting…
Micho Rizo
  • 1,000
  • 3
  • 12
  • 27
0
votes
0 answers

eclipselink jpa joined table inheritance with mappedsuperclass

I have 2 tables. Employee and EmployeeDetails. Employee table has the basic details like Employee Id, Department and some audit fields like Created By, Created Timestamp. EmployeeDetails table has all the personal details about the employee and same…
0
votes
1 answer

How do I reverse Engineer with hibernate to get mapped superclass

I have six tables that have many common fields. Ten years ago I specified something to Hibernate Reverse Engineering to create a mapped superclass and six classes that extend that class. I could do it manually, but I am sure the capability must…
0
votes
1 answer

org.hibernate.hql.internal.ast.QuerySyntaxException: BaseModel is not mapped

I am trying to add a state for the base model which records wether the records are 'ACTIVE', 'DELETED' or 'IN_PROGRESS' Here's my code : public interface BaseRepository extends JpaRepository { …
heshik nandan
  • 21
  • 1
  • 5
0
votes
0 answers

JPA: How to build a ManyToMany Relationship between subclasses with @MappedSuperclass and inherited ID

I face a problem with building a ManyToMany Relationship between subclasses-entities of my app, which inherit the id (database id) field from superclass and also other 2 variables. @MappedSuperclass used for mapping only the sublasses on the…
0
votes
1 answer

How to override parent @MappedSuperclass @column attributes in child entity extending parent while inserting child entity

I have two classes A & B, B extends A and A is @MappedSuperclass as it is extended by other entities as well for some common fields. Class A @MappedSuperclass public class A implements Serializable { @Column(name="TYPE_ID") private String…
ngCoder
  • 2,095
  • 1
  • 13
  • 22
0
votes
1 answer

Symfony2: Entity extends MappedSuperClass extends FOSUserBundle User

I created a BaseBundle with a SuperUser MappedSuperClass who extends FOSUserBundle User use FOS\UserBundle\Model\User as FOSUser; /* * @ORM\MappedSuperclass */ class SuperUser extends FOSUser { /** * @var string *…
0
votes
0 answers

How to implement repository in Spring data JPA when MappedSuperClass is involved?

I'm implementing the repository structure of an entity which extends a MappedSuperClass in Sping data JPA. Base.java: @MappedSuperclass public abstract class Base { public abstract Long getId(); public abstract void setId(Long id); …
User1230321
  • 1,435
  • 4
  • 23
  • 39