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
1
vote
1 answer

What is a Doctrine-centric approach to work with repositories that use entities in mapped superclass configuration?

I have several entities that are related, such as McDoublePrice, CheeseburgerPrice, BigMacPrice, etc, which have a common BurgerPrice entity in a Mapped Superclass Doctrine configuration. How can I access a particular entity from my controller,…
Dennis
  • 7,907
  • 11
  • 65
  • 115
1
vote
1 answer

Doctrine. Class XXX is not a valid entity or mapped super class

I'm trying to do my first DAO with Doctrine for doing a list method. My entity class is Canales.php in /src/model/dto folder namespace model\dto; use Doctrine\ORM\Mapping as ORM; /** * Canales * * @ORM\Table(name="Canales") * @ORM\Entity …
barthuin
  • 105
  • 2
  • 12
1
vote
1 answer

Why can I not override and annotate a getter method for entity mapping?

Given this class: @MappedSuperclass public abstract class AbstractEntity { int id; public void setId(int id) { this.id = id; } public int getId() { return id; } // other mappings } I want to define an entity: @Entity public class…
Mark
  • 2,167
  • 4
  • 32
  • 64
1
vote
2 answers

JPA 2.0 null inherited fields from mappedsuperclass at flush operation

I have the following hierarchy @MappedSuperclass public class MensajeErrorBase{ @Enumerated(EnumType.STRING) @Column(name = "SEVERIDAD", nullable = false, length = 50) protected EnumSeveridadMensaje severidad; //... } @Entity @Table(name =…
1
vote
1 answer

@MappedSuperclass and implementation table

I inherited some pretty awful code that I am looking to refactor to make more reusable. There is a set of reporting tables which are primarily composed of 3 columns: id, report_type_fk, and report_description. I would like to merge all the…
Dan
  • 979
  • 1
  • 8
  • 29
1
vote
1 answer

Doctrine ODM - Specify collection name for MappedSuperclass

Doctrine ODM has annotation (collection) to specify which name should be used for collection. It defaults to class name but can be changed easily. However I have mapped superclass which is extended by other classes. Inheritance type is single…
Josef Sábl
  • 7,538
  • 9
  • 54
  • 66
1
vote
1 answer

hibernate, inherit all entities from a @MappedSuperClass

i want set some fields, like updateDate, createDate and deleteDate, for each my entities, so i thought to inherit my entities from a @MappedSuperClass that contains this properties. Is this a good pratice? In what way you work for this kind of…
blow
  • 12,811
  • 24
  • 75
  • 112
1
vote
2 answers

Java Constructor of a Subclass

I have a subclass extending a superclass. If constructor in super class has parameters a,b,c like MySuperClass(int a, string b, string c). And the constructor in the subclass has parameters a,d,e like MySubClass(int a, int d, int e), what should go…
Amir
  • 317
  • 5
  • 18
1
vote
0 answers

symfony create a table with attribute from multiple entities

I have different entities like: Element, Status, Action, Contributor ... And I need to create an entity, let say Synonym, which can be related to one of these previous entities My entity Synonym, can be a synonym of the entity Element or Status or…
misterlil
  • 11
  • 4
1
vote
3 answers

Hibernate inheritance mapping unknown property

I am struggling with my inheritance structure where I have a mapped superclass which contains a common field in the concrete classes. This superclass has a one-to-one mapping with a "wrapper" object. The objects look like this; @Entity public class…
gwnp
  • 1,127
  • 1
  • 10
  • 35
1
vote
1 answer

Doctrine :: cannot read from child entities

I have a entity, BaseValue, as a mapped superclass. A second entity, called Field, is mapping this superclass. I can store it and the values of the child classes from BaseValue are stored in the correct table. But if I try to read them, I got this…
n00n
  • 654
  • 1
  • 10
  • 30
1
vote
0 answers

JPA, MappedSuperclass, Column ID cannot accept NULL

I had tables like Customer, Request and so on and each had ID field; I have now an abstract @MappedSuperclass instead that have @Id @GeneratedValue private Long id field, and all tables extends it with @AttributeOverride(name="id",…
Vadim
  • 105
  • 1
  • 9
1
vote
1 answer

how to specify what extends what in doctrine mappedsuperclass with xml mapping

I'm trying to figure out how the superclass mapping works in Doctrine2, and I have some examples to work with, but I've been using the xml mapping to create my Entities and then in turn the database schema. I found one example that showed an…
Scott
  • 7,983
  • 2
  • 26
  • 41
1
vote
2 answers

Apply generic class @MappedSuperclass as targetEntity.Error: @ManyToOne on models.Unit.parent references an unknown entity: models.GenericHierarchic

I have generic class that extend other generic class. All of them is @MappedSuperclass. So they dont have own table in database. They are also abstract, so they dont have any objects. They are just skeleton for my entities @Entity My inheritance…
masterdany88
  • 5,041
  • 11
  • 58
  • 132
1
vote
0 answers

Hibernate - Mixing MappedSuperClass and Embedded ORM Strategies

I have an existing Hibernate Entity hierarchy I am working with. The Entities already use MappedSuperClass to inherit some common fields from base classes. In my scenario I need to inherit these fields as well and in addition need to leverage some…