Luciano,
@TenantDiscriminatorColumn is defaulting the
contextProperty to eclipselink.tenant-id therefore you must set
the default contextProperty,
that is, eclipselink.tenant-id
either in your persistence.xml,
or per entity
manager. Eg.
em.setProperty("eclipselink.tenant-id",
value);
Also, please
note your are using
multitenancy but
given the subject I wonder
if you meant to use
@Inheritance(SINGLE_TABLE)
@DiscriminatorColumn(name
="TP_NOTIFICATION")
instead?
Cheers,
Guy
On 11/06/2013 8:25 AM, Luciano Santos
wrote:
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
_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users
--
![Oracle](gifn5JcOjXRuO.gif)
Guy Pelletier
ORACLE Canada,
45 O'Connor Street
Suite 400
Ottawa, Ontario
Canada K1P 1A4
Oracle is committed to developing practices
and products that help protect the environment
|