| JPA Partitioning and Spring [message #788543] |
Wed, 01 February 2012 18:33  |
Mike Key Messages: 6 Registered: February 2012 |
Junior Member |
|
|
I am interested in using ValuePartioning with Eclipselink 2.3.2. I have a couple of questions that seem somewhat unclear, the first may answer the second by default.
1) Is it possible to use partitioning with Spring? I configure my EclipseLink via Spring's EclipseLinkJpaVendorAdapter and my entity manager (for now) with LocalContainerEntityManagerFactoryBean. This appears to only allow for a single data source (which currently is a DBCP connection pool). It seems unclear to me how I could define multiple pools for partitioning using these classes. For example I can only set one data source in my entity manager from here.
2) I assume if my first question is possible, then I can use an external connection pool (eg. C3P0 or DBCP) to configure as my data sources, even though the property names for each node suggest they are internal EclipseLink pools?
Thanks for any insight here, much appreciated in advance.
|
|
|
| Re: JPA Partitioning and Spring [message #789183 is a reply to message #788543] |
Thu, 02 February 2012 12:57   |
James Sutherland Messages: 1844 Registered: July 2009 |
Senior Member |
|
|
You define the additional connection pools using persistence unit properties,
"eclipselink.connection-pool.mypool2.nonJtaDataSource"="<jndi-name>"
The connection pool name is referenced in your partitioning policies, so it is independent of the actually DataSource.
If your DataSource cannot be looked up in JNDI, then you can set it directly. You will need to use a SessionCustomizer for this that gets the ConnectionPool from the ServerSession and configures its Connector on its DatabaseLogin.
You can also use EclipseLink's connection pooling.
James : Wiki : Book : Blog
|
|
|
|
|
|
| Re: JPA Partitioning and Spring [message #789252 is a reply to message #789227] |
Thu, 02 February 2012 14:35   |
Mike Key Messages: 6 Registered: February 2012 |
Junior Member |
|
|
I have seen that you need a SessionCustomizer for JTA data sources used in this way which give the error I'm seeing. As I'm not using a JTA resource I didn't figure I needed that. Taken from EclipseLink documentation here in the Tomcat-Web-Tutorial examples for Eclipselink (sorry forum wouldn't let me post the URL).
In the section regarding Session Customizer. I just want to validate this is still required when using a non-JTA resource.
I guess the better question I could ask is...is it possible using Spring configuration to pass in the JNDI resource to EclipseLink for both of my data sources? Spring has already done the JNDI lookup, but I can't see how I can just pass EclipseLink the data source Spring has configured.
In Spring I am using the EclipseLinkJpaVendorAdapter.
[Updated on: Thu, 02 February 2012 14:38] Report message to a moderator
|
|
|
| Re: JPA Partitioning and Spring [message #793912 is a reply to message #789252] |
Wed, 08 February 2012 13:39  |
James Sutherland Messages: 1844 Registered: July 2009 |
Senior Member |
|
|
I think you still needs to use a SessionCustomizer for JNDI on Tomcat. I think you need to set the lookup type on the JNDIConnector.
((JDNIConnector)session.getLogin().getConnector()).setLookupType(JDNIConnector.STRING_LOOKUP)
Please log/vote for the bug on this. There should be a way to use string lookup with using a customizer.
James : Wiki : Book : Blog
|
|
|
Powered by
FUDForum. Page generated in 0.09321 seconds