Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[eclipselink-users] Multi level inheritance example

Hello.

I am struggling a little bit to make this single table two level/two column inheritance:

@Multitenant(SINGLE_TABLE)
@TenantDiscriminatorColumn(name = "TP_NOTIFICATION")
public abstract class Notification
...
@Column(name = "TP_NOTIFICATION", length = 1, insertable=false, updatable=false)
    private NotificationType type;
...
}

@DiscriminatorValue("N")
class NegativeNotification extends Notification {}

@DiscriminatorValue("H")
@TenantDiscriminatorColumn(name="TP_HARM", length=2)
class HarmNotification
...
    @Column(name = "TP_HARM", insertable=false, updatable=false)
    private HarmType harmType;
...
}

@DiscriminatorValue("IN")
class InfluenzaNotification extends HarmNotification

@DiscriminatorValue("PE")
class PertussisNotification extends HarmNotification

...

So far the deployment is OK, but a query for HarmNotification fails on the say to try a store operation:
Exception Description: No value was provided for the session property [eclipselink.tenant-id]. This exception is possible when using additional criteria or tenant discriminator columns without specifying the associated contextual property. These properties must be set through Entity Manager, Entity Manager Factory or persistence unit properties. If using native EclipseLink, these properties should be set directly on the session.
Query: ReadAllQuery(referenceClass=HarmNotification sql="SELECT t0.CO_SEQ_...

Do you guys have an example on how i need to declare this to make it work?

Thanks

Luciano G Santos

Back to the top