Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] Bypassing multitenant criteria‏

Hi!

I have had a look at it, and there seems too high a risk to start changing core code to make this work, as the spring transaction manager uses a thread local to hold onto EM during a single transaction. As this is very fiddly and not something I want to break, I have very unfortunately skipped the (automatic) multitenant support for now. I'd rather do it the right way, and see if I can write a patch for Eclipselink. I see that the actual query is rewritten in DescriptorQueryManager in the postInitialize(AbstractSession session)  line 918. However, I take that the query is probably cached at some level and I see that this method in only called at initialisation of the context(?). Any help on how I could write this? :-)

Thanks again for your precious help!

Best regards
Morten


Date: Wed, 24 Aug 2011 13:56:17 -0400
From: guy.pelletier@xxxxxxxxxx
To: hardhousemouse@xxxxxxxxxxx
Subject: Re: [eclipselink-users] Bypassing multitenant criteria

Hi Morten,

You're correct, there will be multiple EMF's. Unfortunately I am not well versed with Spring but I did ask around here with others who have had some experience with it. Unfortunately to no avail though, so perhaps best to put the question to the Spring forum.

Sorry I don't have a better answer, but hopefully someone at Spring will.

Cheers,
Guy

On 24/08/2011 12:45 PM, Morten - wrote:
Hi Guy,

I got the mapping to work through XML! :-)

However, I now face another problem. I will end up with multiple EntityManagerFactory won't I?
I then have a problem with running with spring's transaction manager as it proxies all accesses to have createEntityManager(..) calls so the same EM is returned always inside the same transaction.

I would like to call functions like:
* transactionStart
* login()  - using the sharedEMF
* list orders - using multitenantEMF
* transactionEnd

Do you have any idea how I can solve this?

Thank you very much for your time and support!

Best regards
Morten


Date: Wed, 24 Aug 2011 10:39:41 -0400
From: guy.pelletier@xxxxxxxxxx
To: hardhousemouse@xxxxxxxxxxx
Subject: Re: [eclipselink-users] Bypassing multitenant criteria

Hi Morten,

You can set the following property to see more logging in your persistence unit properties:

<property name="eclipselink.logging.level" value="FINEST"/>

Also, if your eclipselink-orm.xml file is in the META-INF/ and named (eclipselink-orm.xml) dir it should find it automatically. Or alternatively you can add it explicitly with:

<mapping-file>META-INF/eclipselink-orm.xml</mapping-file>

Cheers,
Guy

On 24/08/2011 9:53 AM, Morten - wrote:
Hi again!
Great! Thanks a lot or your help!

I have been trying this,  but I cannot get eclipselink to see my (eclipselink)-orm.xml file, is there any way I can see what is going up during startup? I tried dropping the loglevel
<logger name="org.eclipse.persistence" level="TRACE" /> but still no info. Any class I can breakpoint? :-)
I'm using Spring 3 if that is of any consequence for how this is easiest set-up.

Best regards
Morten


Date: Wed, 24 Aug 2011 09:39:28 -0400
From: guy.pelletier@xxxxxxxxxx
To: hardhousemouse@xxxxxxxxxxx
Subject: Re: [eclipselink-users] Bypassing multitenant criteria

Hi Morten,

Yes that would be a great way to do it. Have one XML mapping file with all the standard JPA metadata which is used in both PU's and a separate eclipselink-orm.xml for each PU. One that adds multitenant metadata and one that does not.

Cheers,
Guy

Back to the top