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
2
votes
0 answers

Is it possible to override table name in Doctrine Entities?

I'm using Doctrine ORM. When trying to get data from database I get this error: Fatal error: Uncaught PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'db.GenericMeasurements' doesn't exist Code that generates error: $sensor…
bartek_zet
  • 185
  • 11
2
votes
0 answers

Java Spring @MappedSuperclass field as @Id field in child class

I have the following superclass that will be extended by many classes. Its one property, foreignKey, will be the @Id for one of the inheriting classes. The superclass: @MappedSuperclass public abstract Superclass { …
user2360507
  • 93
  • 1
  • 7
2
votes
2 answers

"Impossible to execute Save action: org.hibernate.exception.DataException: could not execute statement" using OpenXava?

I am very new to Java and am in need of some help. I have created a @MappedSuperclass "Attendees" using OpenXava. import javax.persistence.*; import org.hibernate.annotations.*; import org.openxava.annotations.*; @MappedSuperclass public class…
Andi
  • 25
  • 3
2
votes
0 answers

Override association many-to-many with a mapped superclass in Doctrine

I want to make a many-to-many association between a mapped superclass CommonResource and an entity Author. We are using the syntaxis provided by the doctrine manual on this topic: association override doctrine. But when I validate the doctrine…
2
votes
1 answer

How to implement database inheritance in Spring Data JPA with MapperSuperClass?

I'm trying out database inheritance of type JOINED in Spring Data JPA, referring to this article. This worked fine. But I've to implement MappedSuperClass in my project. I've implemented in the following way: Base.java @MappedSuperclass public…
User1230321
  • 1,435
  • 4
  • 23
  • 39
2
votes
2 answers

@MappedSuperclass with more than 1 inheritance level throws Repeated column in mapping for entity exception

I have created a parent class to have the fields or mappings common for all the entities in a single place. But when the inheritance level is more than 1, hibernate throws the exception MappingException: Repeated column in mapping for entity The…
dharshan
  • 733
  • 4
  • 11
  • 24
2
votes
1 answer

EBean in Java - Inheritance with @MappedSuperclass

I'm currently writing a new Java project with Play Framework 2.2.2 on Ubuntu. I'm attempting to set up a very simple class hierarchy that will allow the different db-persistable elements to inherit common fields, such as id, created_at, deleted_at…
mistakenot
  • 554
  • 3
  • 14
2
votes
0 answers

Doctrine 2 - How to have an association class with a mapped superclass?

I'm having trouble with a Doctrine 2 mapped superclass, to define a ManyToMany Relation. My code is : use Doctrine\Common\Collections\ArrayCollection; /** @MappedSuperclass */ abstract class MyAbstractClassA { /** * @Id *…
ena
  • 85
  • 7
2
votes
1 answer

doctrine class-inheritance with lifecyclecallback and annotation driver

I got a problem with doctrine orm using annotation driver releated to the lifecyclecallback. I got 2 classes: abstract Model (marked as MappedSuperclass, haslifecyclecallbacks) User (extending Model, marked as entity) the prePresist method isn't…
Patrick
  • 1,562
  • 1
  • 16
  • 33
1
vote
2 answers

JPA MappedSuperClass common audit value for all entities

I have several JPA entities, each Entity has a database user column, in that column I have to store the user that makes changes to a specific row in the table. I created a 'MappedSuperclass' Bean that all the entities would extend from, this is the…
chrtnmrc
  • 31
  • 3
1
vote
1 answer

How to refer mapped superclass fields in JPA query syntax?

I have a class with multiple mapped superclasses @EqualsAndHashCode(callSuper = true) @Entity(name = "Supported_cars_usage") @Data @NoArgsConstructor public class SupportedCarUsage extends SupportedUsageBase { @ManyToOne(fetch = FetchType.LAZY,…
Dims
  • 47,675
  • 117
  • 331
  • 600
1
vote
1 answer

Spring - JPA join abstract class in abstract class

I have a problem with JPA inheritance. The database model is also specially built. It contains several tables with the same attributes (the tables were intentionally cut by country) and all these tables connect to another table (OneToOne). Here is…
1
vote
1 answer

Common JPA base entity separate primary key sequences

I have a UserAuthenticationEntity extending from BaseEntity. @MappedSuperclass public class BaseEntity implements Serializable { @Id @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "user_seq_generator") @SequenceGenerator(name…
Meena Chaudhary
  • 9,909
  • 16
  • 60
  • 94
1
vote
0 answers

How to add indexes in an extended entity with Doctrine2?

I'm using Doctrine2 to extend an Entity. The main entity is so defined: /** * ERP_Articoli * @ORM\Table(name="erp_articoli", indexes={ * @Index(name="search_company", columns={"company"}), * @Index(name="search_codfam",…
Ale TheFe
  • 1,540
  • 15
  • 43
1
vote
1 answer

ER Modelling - Subclass relationships & Relationship Entities

I have a couple of specific questions regarding ER modelling. To provide some specific context, this is for a university project and I seem to not be able to hunt down specific answers to these questions. Background The ER model is depicting a…