Skip to main content


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] Sat, 19 January 2013 00:32 Go to next message
Donat Mueller is currently offline Donat MuellerFriend
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 224 times)
Re: tenant property not found on cascading delete [message #1002634 is a reply to message #1002621] Sat, 19 January 2013 01:27 Go to previous messageGo to next message
Donat Mueller is currently offline Donat MuellerFriend
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 14:59 Go to previous message
James Sutherland is currently offline James SutherlandFriend
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: Tue Apr 16 14:57:30 GMT 2024

Powered by FUDForum. Page generated in 0.40596 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top