super « Map « JPA Q&A

1. Hibernate ManyToMany and superclass mapping problem

I need to create a relation in Hibernate, linking three tables: Survey, User and Group. The Survey can be visible to a User or to a Group, and a Group is form ...

2. Hibernate Mapped Superclass relationships and overriding

I have an abstract MappedSuperClass, Participant, which is extended by three kinds of 'Participant'. Each one then uses its own kind of 'Project', also an abstract MappedSuperClass. However, I want the ...

3. Hibernate, single table inheritance and using field from superclass as discriminator column

I have following kinds of classes for hibernate entity hierarchy. I am trying to have two concrete sub classes Sub1Class and Sub2Class. They are separated by a discriminator column (field) that ...

4. JPA (and inheritance) how do I get all entities of a given superclass

Given the following entity definitions:

class abstract A {
    Collection<A> parents;

class B extends A {


class C extends A {

is it possible to define a method which returns all entities ...

5. Multiple ManyToMany relationships using "mappedBy" with Super class member

I am developing an application using Hibernate and am trying to model the following scenario: I have an Activity Abstract class, defined as follows:

@Table(name = "BF_ACTIVITY")
public abstract class Activity extends PersistableObject {


6. Hibernate query on superclass property

First of all, please forgive my ignorance in both Java and Hibernate, I'm studying different ORM solutions and am not a Java programmer. 1) Is it possible to map the following class ...

7. Hibernate - Many-to-Many relationship in superclass not inherited

Hi Guys, I have a Hibernate mapping files like the below. When I retrieve a Purchase Order(my super class) I get back a list of Catologs aswell. But when Invoice (subclass) is retrieved I do not get back a list of asscociated catolgs. The sub class does retrieve all other inherited properties. What could this problem be? Anything to do with ...

8. entity not mapped when saving superclass

I have an entity which a few classes extend. The extended classes do not have any Entity annotations (or xml etc). So I save an extended class expecting that the only annotated entity is saved. My intention is to use some of the extended properties during gui operations which never need to be saved. Can I achieve this (I already tried ...

9. Configure a combined, inherited index on a mapped superclass

i want to create an index with multiple columns on a mapped superclass. The default way in hibernate is the hibernate extension to @table that contains an indexes property. my problem is that the mapped superclass is abstract and has 10 classes that need to inherit the index. That means in my database are 10 tables that require this index. Since ...

10. can I make a map super lazy ?

11. super interface as member of subinterface impl mapping

[b]Hibernate version:[/b] 3.0.5 Hello Hibernate Experts! I have the following heirarchy (adapted from AppFuse) and have been struggling with the mapping file(s). My goal is a MinimalUser-centric system with decorators (E.G. Model is a decorator), as well as "aspects" (E.G. PictureSet), and I don't want repeated data in the DB (I have soutions that violate these preferences, but I am looking ...

13. Multiple Inheritance with Interfaces and Superclass

Caused by: org.hibernate.MappingException: Could not determine type for: java.util.Set, for columns: [org.hibernate.mapping.Column(inhalt)] at org.hibernate.mapping.SimpleValue.getType( at org.hibernate.mapping.SimpleValue.isValid( at org.hibernate.mapping.Property.isValid( at org.hibernate.mapping.PersistentClass.validate( at org.hibernate.mapping.RootClass.validate( at org.hibernate.cfg.Configuration.validate( at org.hibernate.cfg.Configuration.buildSessionFactory( at de.nordakademie.schnak.util.HibernateUtil.( ... 1 more

15. Mapping a concrete class whose superclass contains id

I have been working on a set of domain objects that inherit from an abstract class that needs to have knowledge of the identifier's get and set methods. For example: Code: ConcreteClass extends AbstractClass { int id; public int getId() { return id; } public void setId(int id) { ...

16. Virtual Mapping to invoke the SuperClass