Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] Eclipselink mapping question

Hi Leon,

I suspect that removing the @DiscriminatorColumn(name="PRODUCT_TYPE") annotation will solve your problem.

In this case it looks to me like you are trying to inherit an attribute rather than implement inheritance. The DiscriminatorColumn is used for JPA Inheritance.

-Tom

Leon Derks wrote:
Hello

I have the following problem:

I defined a BaseEntity for all my Entity classes. This BaseEntity class contains only the id.
In this way I don't need to define id variables in every Entity class.

I have a CatalogProduct class which extends the BaseEntity class.
But when I run the query for an entity, for example: em.createQuery("select p from CatalogProduct p").getResultList(), it always tries to select from the BaseEntity table which doesn't exist.

What is causing the problem?

@MappedSuperclass
public abstract class BaseEntity {
     @Id
   @Column(name="id")
   private long id;

   public long getId() {
       return id;
   }

}

@Entity
@Table(schema="PLI", name = "PLI_CATALOG_PRODUCTS")
@DiscriminatorColumn(name="PRODUCT_TYPE")
public abstract class CatalogProduct extends BaseEntity{
  ......
  ......
}

Leon
_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users


Back to the top