To follow up and correct what I
mentioned earlier, I think you will want to inject the
EntityManagerFactory using @PersistenceUnit.
@PersistenceUnit
private EntityManagerFactory emf;
And in your list method you will do
public List<Item> listActiveItems() {
HashMap properties = new HashMap();
properties.put("eclipselink.session-name", "cust_tables");
properties.put("tenant_schema_name", "cust_tables");
EntityManager em = emf.createEntityManager(properties)
}
Alternatively, if you're actually wanting to use a static tenant in listActiveItems (i.e "cust_table") I think you can stick with @PersistenceContect injection but you will need to provide the properties up front through the context, e.g.:
@PersistenceContext(
properties={
@PersistenceProperty(name="eclipselink.session-name", value="cust_tables"),
@PersistenceProperty(name="tenant_schema_name" value="cust_tables")
}
)
Cheers,
Guy
On 06/02/2013 1:26 PM, exabrial wrote:
Should I be acquiring some sort of ClientSession or DatabaseSession?
I added a sessionCustomizer, and set a breakpoint on the customize(Session
session) method. The session is a ServerSession and it's
multitenantContextProperties == null. Furthermore customize(Session session)
is only called during bootstrap.
--
View this message in context: http://eclipse.1072660.n5.nabble.com/TENANT-PER-TABLE-Problem-Can-t-compile-Named-Query-tp157573p157586.html
Sent from the EclipseLink - Users mailing list archive at Nabble.com.
_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users
--

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