Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » tenant property not found on cascading delete
tenant property not found on cascading delete [message #1002621] Fri, 18 January 2013 19:32 Go to next message
Donat Mueller is currently offline Donat Mueller
Messages: 11
Registered: January 2013
Location: switzerland
Junior Member
Hi,

I have set up a multy tenancy orm mapping.
Inserting works fine but when I try to delete a record that was read before I get an exception No value was provided for the session property [eclipselink.tenant-id].
I did not model the tenantid in my pojo's. So the translationRow does not contain tenancy information:

ArrayRecord(
model_ValueContainer.dbId => 1
model_ValueContainer.TENANT_ID => null
model_ValueContainer.externalId => 1
model_ValueContainer.name => Realestate
model_ValueContainer.state => 0
model_ValueContainer.template => null
model_ValueContainer.type => Domain)

ParameterExpression on line 265 gets null for the field: eclipselink.tenant-id
value = session.getProperty(getField().getName());

I have set the properties on creation of the entity manager.
Code: [Select all] [Show/ hide]
Long tenant = getTenantsForUser("testuser").get(0);
Map<String, Object> emProperties = new HashMap<String, Object>();
emProperties.put("eclipselink.tenant-id", tenant);
EntityManager entityManager = emf.createEntityManager(emProperties);


Should I configure sessions.xml to get this to work ?

Any ideas/help appreciated
Donat
  • Attachment: model.png
    (Size: 29.08KB, Downloaded 48 times)
Re: tenant property not found on cascading delete [message #1002634 is a reply to message #1002621] Fri, 18 January 2013 20:27 Go to previous messageGo to next message
Donat Mueller is currently offline Donat Mueller
Messages: 11
Registered: January 2013
Location: switzerland
Junior Member
While debugging I noticed that eclipse link does something like this gets the ServerSession by UnitOfWork.ghetParent().getParent().
There the database credentials and url is stored in the properties. The UnitOfWork properties are just ignored.
When I add the properties to the server session by:

		Session session = ((EntityManagerImpl) entityManager).getActiveSession();
		UnitOfWork uow = (UnitOfWork) session;
		uow.getParent().getParent().setProperty(PersistenceUnitProperties.MULTITENANT_PROPERTY_DEFAULT, tenant);


It works.
But this is not a solution to my problem.
Re: tenant property not found on cascading delete [message #1004089 is a reply to message #1002634] Tue, 22 January 2013 09:59 Go to previous message
James Sutherland is currently offline James Sutherland
Messages: 1939
Registered: July 2009
Location: Ottawa, Canada
Senior Member

If insert is working, and delete is not, then it seems to be a bug. Please log the bug with the details and workaround.

The issue seems to be the delete is using the wrong session to get the property from.


James : Wiki : Book : Blog : Twitter
Previous Topic:JPA + Native interference
Next Topic:get sequence number through Eclipselink
Goto Forum:
  


Current Time: Sat Aug 02 02:37:17 EDT 2014

Powered by FUDForum. Page generated in 0.01724 seconds