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

Refactoring Entities with common fields but with different @JoinColumn parameters

I have several entities that have same fields which are common to many tables. But those fields are not linked with the same parameter name in the relational tables(see object_1 and object_2 in the attached image). I creacted an abstract class…
Aguid
  • 943
  • 2
  • 10
  • 24
0
votes
1 answer

JPA relation between two classes

I have a task to build a document which contains header and rows. for example Stock income document which contains the header (date, stock) and the rows (material, quantity, price, sum). My problem is that I am not sure that my classs architecture…
user3493004
  • 85
  • 4
  • 12
0
votes
1 answer

Symfony MappedSuperclass store Entity reference

I'm currently writing a MappedSuperclass to store entity reference on an entity object. For example to store favorites for a user, it can be any kind of model (product, category of product or whatever). The class contains deux fields : entityType :…
Dr. Z
  • 236
  • 3
  • 19
0
votes
1 answer

Hibernate - SuperClass -MappedSuperClass

How can I provide a relationship between two derived class from the same class on hibernate. I have a class named BaseEntity and it has some attributes that every derived class will have too, such as updateDate,updateID. And I have two classes…
Picture
  • 51
  • 9
0
votes
2 answers

Doctrine 2 many-to-many with MappedSuperclass in Zend framework 2

I am new to Doctrine2 and trying to create entities for the following DB structure: I want to have all machine parts as an array in one attribute of the machine class. I tried this: class Machine { .... /** * @var array *…
SBay
  • 23
  • 4
0
votes
1 answer

"No serializer found for class play.data.Form"-Exception on helper class form binding

I have an inheritance structure where SubtaskGroupA and SubtaskGroupB both inherit from the @MappedSuperclass Subtask and to allow the user to submit multiple Subtasks of one Group. I use a helper class SubtaskList with a field List subtasks. A form…
0
votes
1 answer

Mapping Abstract (super class) and subclass in JPA using hibernate

I have a Abstract class product and three sub classes Honey, Wax and Misc. As per definition, the sub classes extend the Product class and add few extra fields. I am using the JPA annotations to perform the mappings. The classes are given…
avizzzy
  • 440
  • 9
  • 21
0
votes
1 answer

JPA - is it possible to get result as an instance of @MappedSuperclass?

Regarding the following example, is it possible to retrieve list of AnsweredQuestion instances as objects of Question? @MappedSuperclass public abstract class Question{ @Column(name="TITLE") private String title; …
Bartek
  • 169
  • 9
0
votes
2 answers

JPA inheritance - how to select 3 entities of each child type?

If you have this type of a JPA entity setup with a super class and a few child classes (see below), how do you write a JPA Query that would select say first 3 (ordered by created date) of each child class? Writing two separate queries and asking for…
SergeyB
  • 9,478
  • 4
  • 33
  • 47
0
votes
1 answer

"field jdoFieldFlags is conflicting" when using @MappedSuperclass on GAE/J & JPA

I got an error when querying to the entity extended by mappedsuperclass on GAE/J. MappedSuperClass import java.sql.Timestamp; import javax.persistence.MappedSuperclass; @MappedSuperclass public abstract class AbstractModel { private String…
N.F.
  • 3,844
  • 3
  • 22
  • 53
0
votes
1 answer

Symfony2.4 abstract class callbacks are not triggered

I use a class that extend an abstract class containing lifecyclecallbacks. My abstract class is annotated with @ORM\MappedSuperclass but my callbacks are not triggered. I saw a lot of problems here and there on this subject but no concrete answers.…
rudak
  • 379
  • 3
  • 16
0
votes
2 answers

JPA differentiating id GenerationType using inheritance

I have two different databases D1, D2 with a same Table T. T has a primary Key column id, that is autogenerated in D1, a simple integer in D2. I've to shift record from T in D1 to T in D2, so I mapped T as an @Entity with JPA. The problem is that…
Francesco Umani
  • 69
  • 4
  • 10
0
votes
0 answers

JPA one entity 3 tables

I have three tables each having the same coloumns. One of them has the original measured data, the other ones have the data aggregated to minutes and hours. When loading the data in JPA I want to have the same entity/class for every set of data. I…
brancz
  • 451
  • 5
  • 15
0
votes
2 answers

eclipselink inheritance implementation

I am trying to implement ElcipseLink JPA2.0 for inheritance in my project. Can't use annotation. only xml mappings. Here is my code. public class DefaultEntity { } public class SpecialEntity extends DefaultEntity { public String name;…
PGK
  • 141
  • 3
  • 12
0
votes
1 answer

Symfony / Doctrine: add annotiation to Attribute defined in 'MappedSuperclass'

Edit: I learned, that there's an annotiation missing for my subclass ('here it's just an ID', thx to GreenLeaf). My actual problem now is, that I don't know, how to override this, I can't get it to work. Original: I just migrated a Symfony 2.0…
Sammy
  • 1,178
  • 1
  • 14
  • 27
1 2 3 4 5 6
7