Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[eclipselink-users] Partitioning with multiple data sources per persitance unit

Hi,

I have developed a relatively simple JPA web app using JBoss 7.2.
Everything works fine with Hibernate as underlying JPA impl but since
Hibernate does not provide partitioning (will use many many terabytes
of data) I moved to EclipseLink 2.4.1.v20121003-ad44345. No JPA
relationships should spans partitions, I want keep things as simple as
possible. Everything went smooth during transition and app works fine
using single JTA data source with EclipseLink.

However, I ran into problems with multiple JTA data sources for
persistance unit I am using. I pointed persistance unit to another JTA
data source using:
<property name="eclipselink.connection-pool.node2.jtaDataSource"
value="java:/DS2" /> in my persistence.xml

I followed documentation and annotated entity classes with
partitioning annotations. Unlike all the documentation and examples I
would like to keep using CMT for transaction management (if possible).
What are the things to watch for if using multiple JTA data sources
per persistance unit? How would I even define multiple data sources
(if above approach is invalid) and associate them with persistance
unit properly? In summary I can see that some data gets partitioned
during data import but there are situations where tx is not associated
properly with EntityManager calling persist/merge

Caused by: javax.persistence.TransactionRequiredException: JBAS011469:
Transaction is required to perform this operation (either use a
transaction or extended persistence context)
	at org.jboss.as.jpa.container.AbstractEntityManager.transactionIsRequired(AbstractEntityManager.java:692)
[jboss-as-jpa-8.0.0.Alpha1-SNAPSHOT.jar:8.0.0.Alpha1-SNAPSHOT]
	at org.jboss.as.jpa.container.AbstractEntityManager.merge(AbstractEntityManager.java:547)
[jboss-as-jpa-8.0.0.Alpha1-SNAPSHOT.jar:8.0.0.Alpha1-SNAPSHOT]
	at acme.DefaultDailyChainImporterService.importDailyOptionChain(DefaultDailyChainImporterService.java:61)
[classes:]


Also, sometimes there are tx rollbacks due to:

19:34:53,286 ERROR [org.jboss.as.ejb3.invocation]
(http-/127.0.0.1:8080-2) JBAS014134: EJB Invocation failed on
component EquityQuoteImportService for method public void
acme.EquityQuoteImportService.importTicker(java.util.List) throws
java.lang.Exception,acme.CalculationException:
javax.ejb.EJBTransactionRolledbackException
<snip>
Caused by: java.lang.NullPointerException
	at org.eclipse.persistence.internal.sessions.AbstractSession.basicExecuteCall(AbstractSession.java:1800)
[eclipselink-2.4.1.jar:2.4.1.v20121003-ad44345]
	at org.eclipse.persistence.sessions.server.ClientSession.executeCall(ClientSession.java:286)
[eclipselink-2.4.1.jar:2.4.1.v20121003-ad44345]
	at org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.executeCall(DatasourceCallQueryMechanism.java:207)
[eclipselink-2.4.1.jar:2.4.1.v20121003-ad44345]
	at org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.executeCall(DatasourceCallQueryMechanism.java:193)
[eclipselink-2.4.1.jar:2.4.1.v20121003-ad44345]
	at org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.executeSelectCall(DatasourceCallQueryMechanism.java:264)
[eclipselink-2.4.1.jar:2.4.1.v20121003-ad44345]
	at org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.selectAllRows(DatasourceCallQueryMechanism.java:648)
[eclipselink-2.4.1.jar:2.4.1.v20121003-ad44345]
	at org.eclipse.persistence.internal.queries.ExpressionQueryMechanism.selectAllRowsFromTable(ExpressionQueryMechanism.java:2706)
[eclipselink-2.4.1.jar:2.4.1.v20121003-ad44345]
	at org.eclipse.persistence.internal.queries.ExpressionQueryMechanism.selectAllRows(ExpressionQueryMechanism.java:2659)
[eclipselink-2.4.1.jar:2.4.1.v20121003-ad44345]
	at org.eclipse.persistence.queries.ReadAllQuery.executeObjectLevelReadQuery(ReadAllQuery.java:421)
[eclipselink-2.4.1.jar:2.4.1.v20121003-ad44345]


which looks totally weird but I must be doing something wrong. Any
pointers will be greatly appreciated!

Regards,
Vladimir


Back to the top