I'm trying to upload a large batch of items using the BatchUploader class but I'm running into issues with more than 5 lines in the CSV.
Here is the exception I'm getting.
As soon as I get more than 5 entities it throws this exception. At this point I know the issue is coming from app engine. I verified with a simple servlet that just writes entities using JPA. So the problem is independent of SmartGWT. SmartGWT just encounters the issue when it calls into JPA.
That seems to coordinate with the documentation: Transactions and entity groups
What is the a solid workaround for this? I'm hoping to stick with the app engine data store and would prefer to keep transactions if possible.
DataSource:
persistence.xml
Here is the exception I'm getting.
Code:
java.lang.IllegalArgumentException: operating on too many entity groups in a single transaction. [INFO] at com.google.appengine.api.datastore.DatastoreApiHelper.translateError(DatastoreApiHelper.java:39) [INFO] at com.google.appengine.api.datastore.DatastoreApiHelper$1.convertException(DatastoreApiHelper.java:76) [INFO] at com.google.appengine.api.utils.FutureWrapper.get(FutureWrapper.java:94) [INFO] at com.google.appengine.api.datastore.Batcher$ReorderingMultiFuture.get(Batcher.java:129) [INFO] at com.google.appengine.api.datastore.FutureHelper$TxnAwareFuture.get(FutureHelper.java:171) [INFO] at com.google.appengine.api.utils.FutureWrapper.get(FutureWrapper.java:86) [INFO] at com.google.appengine.api.datastore.FutureHelper.getInternal(FutureHelper.java:71) [INFO] at com.google.appengine.api.datastore.FutureHelper.quietGet(FutureHelper.java:32) [INFO] at com.google.appengine.api.datastore.DatastoreServiceImpl.put(DatastoreServiceImpl.java:86) [INFO] at com.google.appengine.datanucleus.WrappedDatastoreService.put(WrappedDatastoreService.java:112) [INFO] at com.google.appengine.datanucleus.EntityUtils.putEntitiesIntoDatastore(EntityUtils.java:766) [INFO] at com.google.appengine.datanucleus.DatastorePersistenceHandler.insertObjectsInternal(DatastorePersistenceHandler.java:314) [INFO] at com.google.appengine.datanucleus.DatastorePersistenceHandler.insertObject(DatastorePersistenceHandler.java:218) [INFO] at org.datanucleus.state.JDOStateManager.internalMakePersistent(JDOStateManager.java:2386) [INFO] at org.datanucleus.state.JDOStateManager.flush(JDOStateManager.java:3783) [INFO] at org.datanucleus.ObjectManagerImpl.flushInternalWithOrdering(ObjectManagerImpl.java:3888) [INFO] at org.datanucleus.ObjectManagerImpl.flushInternal(ObjectManagerImpl.java:3811) [INFO] at org.datanucleus.ObjectManagerImpl.flush(ObjectManagerImpl.java:3751) [INFO] at org.datanucleus.ObjectManagerImpl.preCommit(ObjectManagerImpl.java:4141) [INFO] at org.datanucleus.ObjectManagerImpl.transactionPreCommit(ObjectManagerImpl.java:428) [INFO] at org.datanucleus.TransactionImpl.internalPreCommit(TransactionImpl.java:398) [INFO] at org.datanucleus.TransactionImpl.commit(TransactionImpl.java:287) [INFO] at org.datanucleus.api.jpa.JPAEntityTransaction.commit(JPAEntityTransaction.java:103)
That seems to coordinate with the documentation: Transactions and entity groups
What is the a solid workaround for this? I'm hoping to stick with the app engine data store and would prefer to keep transactions if possible.
DataSource:
Code:
<DataSource ID="product_DataSource" serverConstructor="com.isomorphic.jpa.GAEJPADataSource" beanClassName="com.example.model.Product" > <fields> <field name="productId" type="text" hidden="true" primaryKey="true" /> <field name="productNumber" type="text" title="Product Number" required="true" /> <field name="upc" type="text" title="UPC" canEdit="false" /> <field name="description" type="text" title="Description" canEdit="false" /> </fields> </DataSource>
Code:
<?xml version="1.0" encoding="UTF-8"?> <persistence version="1.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"> <persistence-unit name="ds" transaction-type="RESOURCE_LOCAL"> <provider>org.datanucleus.api.jpa.PersistenceProviderImpl</provider> <class>com.example.model.Product</class> <exclude-unlisted-classes>true</exclude-unlisted-classes> <properties> <property name="datanucleus.ConnectionURL" value="appengine"/> <property name="datanucleus.NontransactionalRead" value="true"/> <property name="datanucleus.NontransactionalWrite" value="false"/> <property name="datanucleus.singletonEMFForName" value="true"/> <property name="datanucleus.appengine.datastoreEnableXGTransactions" value="true" /> </properties> </persistence-unit> </persistence>
Comment