MappedSuperClass « Map « JPA Q&A

1. How to achieve @MappedSuperclass logic using Hibernate ORM mapping?

How to achieve @MappedSuperclass logic using Hibernate ORM mapping?

2. Applying annotations to fields inherited from @MappedSuperclass


class Superclass {

    @Column(name = "id")
    protected long id;

    private long field;

class Subclass extends ...

3. 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 ...

4. Multiple @MappedSuperclass

I'm using JPA 2.0 and EclipseLink 2.2.0. I have a @MappedSuperclass, AbstractEntity, that is the basis for all my entities providing PK and auditing columns. I want to have another @MappedSuperclass extend that ...

5. Hibernate TABLE_PER_CLASS with @MappedSuperclass won't create UNION query

I am trying to create a series of objects that all are stored in separate tables, but that there is a set of fields in common on all these tables. ...

6. Query on attribute from @MappedSuperclass

I have something like the following

@MappedSuperclass public abstract class Foo {
    @Column private String myId;

@Entity public class Bar extends Foo {

@Entity public class Baz extends Foo {
But ...

7. Does @EntityListener works with @MappedSuperclass as well?

Folks! If I define an Entity Class and annotate it with @MappedSuperclass and an @EntityListener, does the listener also get called for lifecycle events within a child class? Example:

public abstract class Animal ...

8. @MappedSuperclass and @Version (Bug?)

Hi, I'm having two problems with @Version mapped in a @MappedSuperClass class. This is a preview of my AbstractEntiy: Code: @MappedSuperclass public abstract class AbstractEntity implements Serializable { @Transient @Column(name = "id") public PK getPrimaryKey() { return primaryKey; ...

9. @Inheritance on @Mappedsuperclass

10. configuration_jndi_name and @MappedSuperClass

Newbie Joined: Mon Nov 26, 2007 12:49 pm Posts: 7 Hi all, I'm using hibernate 3.6.0.Final with jboss 6.0.0.Final embedded and when I use the hibernate.ejb.configuration_jndi_name property to store the configuration object in the JNDI tree, then I get the following exception: Code: Could not bind Ejb3Configuration to JNDI: javax.naming.NamingException: Unable to serialize Ejb3Configuration [Root exception is org.hibernate.mapping.MappedSuperclass] ...

11. @mappedsuperclass and @entity on same class

12. @TypeDef, @Entity & @MappedSuperClass problem

14. Optional persistent associations in a @MappedSuperclass?

Hi all, Is there any way to have a @MappedSupperclass that has an association (@OneToOne in my case) that is not mapped there, possibly marking it with @Transient, but then optionally mapped as a one-to-one in the child classes extending it? I know that I can use the @AssociationOverride but I only want to do it some of the time, not ...

15. @MappedSuperclass in the middle of an inheritance hierarchy

Hi, all, I'm having some issues with declaring a mapped superclass in the middle of an EJB3 inheritance hierarchy. According to the documentation at ... tml#d0e901 this should be possible, but I can't seem to get it to work. Here's my situation: @Entity @Inheritance(strategy = InheritanceType.JOINED) public abstract class SubscriptionTransaction {...} @Entity public abstract class CreditCardTransaction extends SubscriptionTransaction{...} @MappedSuperclass public ...

16. @Where clause with @MappedSuperclass?

17. @MappedSuperclass

Hi, Got a @MappedSuperclass question and I will greatly appreciated any help. Code: @MappedSuperclass class A{ @column(...) private Date modifiedDate; ... ... } @MappedSuperclass class B extends A{ ...

18. @MappedSuperClass vs. @EntityListener

19. @OneToOne pointing to a abstract @MappedSuperclass

Hi, Sorry if this is a FAQ, but I've googled for a few hours and didn't come by an answer... Anyway, I'd like to have a @OneToOne relationship to a abstract class (or a interface would work too) that is implemented by several actual entities. Something like this: Code: @MappedSuperclass public abstract class AbstractShape { ... } @Entity ...