With Postgres, I found that I had to use a Custom Sequence - then put
in the sequence name and then use a Cached PK Size of 1.
This wasn't exactly intuitive and Postgres developers think Cayenne has
issues - but it does seem to work.
WONDER wrote:
> Hi,
>
> I have problem with PostGreSQL ver 8.1.3 using JDBC ver 8.2dev-501 JDBC 3
> and Cayenne 1.2.B2.
>
> I use the Default Strategy to create the PKs using Cayenne. in the DB, i
> created the SEQ : pk_TableName. like pk_image for Table image.
>
> Sometimes I get the following error and sometimes it just work.
> Till now, I coulding find the logic behind.
>
> Anybody can help?
> Thanks.
>
> -------------------------------------------------
> Priority : INFO
>
> Class.Method(line):
> org.objectstyle.cayenne.access.QueryLogger.logQueryError(QueryLogger.java:43
> 9)
>
> Message: *** error.
>
> org.postgresql.util.PSQLException: ERROR: duplicate key violates unique
> constraint "image_pk"
>
> at
> org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorI
> mpl.java:1513)
>
> at
> org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.ja
> va:1298)
>
> at
> org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:349)
>
> at
> org.postgresql.jdbc2.AbstractJdbc2Statement.executeBatch(AbstractJdbc2Statem
> ent.java:2559)
>
> at
> org.objectstyle.cayenne.access.jdbc.BatchAction.runAsBatch(BatchAction.java:
> 164)
>
> at
> org.objectstyle.cayenne.access.jdbc.BatchAction.performAction(BatchAction.ja
> va:114)
>
> at
> org.objectstyle.cayenne.access.DataNodeQueryAction.runQuery(DataNodeQueryAct
> ion.java:95)
>
> at org.objectstyle.cayenne.access.DataNode.performQueries(DataNode.java:309)
>
> at
> org.objectstyle.cayenne.access.DataDomainFlushAction.runQueries(DataDomainFl
> ushAction.java:255)
>
> at
> org.objectstyle.cayenne.access.DataDomainFlushAction.flush(DataDomainFlushAc
> tion.java:177)
>
> at
> org.objectstyle.cayenne.access.DataDomain.onSyncFlush(DataDomain.java:827)
>
> at
> org.objectstyle.cayenne.access.DataDomain$2.transform(DataDomain.java:798)
>
> at
> org.objectstyle.cayenne.access.DataDomain.runInTransaction(DataDomain.java:8
> 53)
>
> at org.objectstyle.cayenne.access.DataDomain.onSync(DataDomain.java:795)
>
> at
> org.objectstyle.cayenne.access.DataContext.flushToParent(DataContext.java:12
> 17)
>
> at
> org.objectstyle.cayenne.access.DataContext.commitChanges(DataContext.java:11
> 21)
>
> at
> de.mrer.base.CayenneBaseComponent.commitChanges(CayenneBaseComponent.java:65
> )
>
> at ImageEditPage.uploadFile(ImageEditPage.java:99)
>
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39
> )
>
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
> .java:25)
>
> at java.lang.reflect.Method.invoke(Method.java:585)
>
> at
> KeyValueCodingProtectedAccessor.methodValue(KeyValueCodingProtectedAccessor.
> java:54)
>
> at
> com.webobjects.foundation.NSKeyValueCoding$_MethodBinding.valueInObject(NSKe
> yValueCoding.java:1160)
>
> at
> com.webobjects.foundation.NSKeyValueCoding$DefaultImplementation.valueForKey
> (NSKeyValueCoding.java:1268)
>
> at com.webobjects.appserver.WOComponent.valueForKey(WOComponent.java:1539)
>
> at
> com.webobjects.foundation.NSKeyValueCoding$Utility.valueForKey(NSKeyValueCod
> ing.java:498)
>
> at
> com.webobjects.foundation.NSKeyValueCodingAdditions$DefaultImplementation.va
> lueForKeyPath(NSKeyValueCodingAdditions.java:212)
>
> at
> com.webobjects.appserver.WOComponent.valueForKeyPath(WOComponent.java:1600)
>
> at
> com.webobjects.appserver._private.WOKeyValueAssociation.valueInComponent(WOK
> eyValueAssociation.java:46)
>
> at
> com.webobjects.appserver._private.WOSubmitButton.invokeAction(WOSubmitButton
> .java:59)
>
> at
> com.webobjects.appserver._private.WODynamicGroup.invokeChildrenAction(WODyna
> micGroup.java:101)
>
> at
> com.webobjects.appserver._private.WODynamicGroup.invokeAction(WODynamicGroup
> .java:110)
>
> at
> com.webobjects.appserver._private.WOComponentContent.invokeAction(WOComponen
> tContent.java:31)
>
> at
> com.webobjects.appserver._private.WODynamicGroup.invokeChildrenAction(WODyna
> micGroup.java:101)
>
> at
> com.webobjects.appserver._private.WODynamicGroup.invokeAction(WODynamicGroup
> .java:110)
>
> at
> com.webobjects.appserver._private.WOComponentContent.invokeAction(WOComponen
> tContent.java:31)
>
> at
> com.webobjects.appserver._private.WOComponentContent.invokeAction(WOComponen
> tContent.java:31)
>
> at
> com.webobjects.appserver._private.WODynamicGroup.invokeChildrenAction(WODyna
> micGroup.java:101)
>
> at
> com.webobjects.appserver._private.WODynamicGroup.invokeAction(WODynamicGroup
> .java:110)
>
> at
> com.webobjects.appserver._private.WOConditional.invokeAction(WOConditional.j
> ava:55)
>
> at
> com.webobjects.appserver._private.WODynamicGroup.invokeChildrenAction(WODyna
> micGroup.java:101)
>
> at
> com.webobjects.appserver._private.WODynamicGroup.invokeAction(WODynamicGroup
> .java:110)
>
> at com.webobjects.appserver.WOComponent.invokeAction(WOComponent.java:945)
>
> at
> com.webobjects.appserver._private.WOComponentReference.invokeAction(WOCompon
> entReference.java:104)
>
> at
> com.webobjects.appserver._private.WODynamicGroup.invokeChildrenAction(WODyna
> micGroup.java:101)
>
> at
> com.webobjects.appserver._private.WODynamicGroup.invokeAction(WODynamicGroup
> .java:110)
>
> at com.webobjects.appserver._private.WOForm.invokeAction(WOForm.java:82)
>
> at
> com.webobjects.appserver._private.WODynamicGroup.invokeChildrenAction(WODyna
> micGroup.java:101)
>
> at
> com.webobjects.appserver._private.WODynamicGroup.invokeAction(WODynamicGroup
> .java:110)
>
> at com.webobjects.appserver.WOComponent.invokeAction(WOComponent.java:945)
>
> at
> com.webobjects.appserver._private.WOComponentReference.invokeAction(WOCompon
> entReference.java:104)
>
> at
> com.webobjects.appserver._private.WODynamicGroup.invokeChildrenAction(WODyna
> micGroup.java:101)
>
> at
> com.webobjects.appserver._private.WODynamicGroup.invokeAction(WODynamicGroup
> .java:110)
>
> at com.webobjects.appserver.WOComponent.invokeAction(WOComponent.java:945)
>
> at
> com.webobjects.appserver._private.WOComponentReference.invokeAction(WOCompon
> entReference.java:104)
>
> at
> com.webobjects.appserver._private.WODynamicGroup.invokeChildrenAction(WODyna
> micGroup.java:101)
>
> at
> com.webobjects.appserver._private.WODynamicGroup.invokeAction(WODynamicGroup
> .java:110)
>
> at com.webobjects.appserver.WOComponent.invokeAction(WOComponent.java:945)
>
> at com.webobjects.appserver.WOSession.invokeAction(WOSession.java:1168)
>
> at
> com.webobjects.appserver.WOApplication.invokeAction(WOApplication.java:1375)
>
> at
> com.webobjects.appserver._private.WOComponentRequestHandler._dispatchWithPre
> paredPage(WOComponentRequestHandler.java:196)
>
> at
> com.webobjects.appserver._private.WOComponentRequestHandler._dispatchWithPre
> paredSession(WOComponentRequestHandler.java:287)
>
> at
> com.webobjects.appserver._private.WOComponentRequestHandler._dispatchWithPre
> paredApplication(WOComponentRequestHandler.java:322)
>
> at
> com.webobjects.appserver._private.WOComponentRequestHandler._handleRequest(W
> OComponentRequestHandler.java:358)
>
> at
> com.webobjects.appserver._private.WOComponentRequestHandler.handleRequest(WO
> ComponentRequestHandler.java:432)
>
> at
> com.webobjects.appserver.WOApplication.dispatchRequest(WOApplication.java:13
> 06)
>
> at
> com.webobjects.appserver._private.WOWorkerThread.runOnce(WOWorkerThread.java
> :173)
>
> at
> com.webobjects.appserver._private.WOWorkerThread.run(WOWorkerThread.java:254
> )
>
> at java.lang.Thread.run(Thread.java:595)
>
>
> --------
>
> Priority : FATAL
>
> Class.Method(line):
> de.mrer.base.BaseComponent.validationFailedWithException(BaseComponent.java:
> 104)
>
> Message: de.mrer.exceptor.CustomException: [v.1.2B2 April 17 2006] Commit
> Exception
>
> ========================
>
> de.mrer.exceptor.CustomException: [v.1.2B2 April 17 2006] Commit Exception
>
> at
> de.mrer.base.CayenneBaseComponent.commitChanges(CayenneBaseComponent.java:74
> )
>
> at ImageEditPage.uploadFile(ImageEditPage.java:99)
>
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39
> )
>
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
> .java:25)
>
> at java.lang.reflect.Method.invoke(Method.java:585)
>
> at
> KeyValueCodingProtectedAccessor.methodValue(KeyValueCodingProtectedAccessor.
> java:54)
>
> at
> com.webobjects.foundation.NSKeyValueCoding$_MethodBinding.valueInObject(NSKe
> yValueCoding.java:1160)
>
> at
> com.webobjects.foundation.NSKeyValueCoding$DefaultImplementation.valueForKey
> (NSKeyValueCoding.java:1268)
>
> at com.webobjects.appserver.WOComponent.valueForKey(WOComponent.java:1539)
>
> at
> com.webobjects.foundation.NSKeyValueCoding$Utility.valueForKey(NSKeyValueCod
> ing.java:498)
>
> at
> com.webobjects.foundation.NSKeyValueCodingAdditions$DefaultImplementation.va
> lueForKeyPath(NSKeyValueCodingAdditions.java:212)
>
> at
> com.webobjects.appserver.WOComponent.valueForKeyPath(WOComponent.java:1600)
>
> at
> com.webobjects.appserver._private.WOKeyValueAssociation.valueInComponent(WOK
> eyValueAssociation.java:46)
>
> at
> com.webobjects.appserver._private.WOSubmitButton.invokeAction(WOSubmitButton
> .java:59)
>
> at
> com.webobjects.appserver._private.WODynamicGroup.invokeChildrenAction(WODyna
> micGroup.java:101)
>
> at
> com.webobjects.appserver._private.WODynamicGroup.invokeAction(WODynamicGroup
> .java:110)
>
> at
> com.webobjects.appserver._private.WOComponentContent.invokeAction(WOComponen
> tContent.java:31)
>
> at
> com.webobjects.appserver._private.WODynamicGroup.invokeChildrenAction(WODyna
> micGroup.java:101)
>
> at
> com.webobjects.appserver._private.WODynamicGroup.invokeAction(WODynamicGroup
> .java:110)
>
> at
> com.webobjects.appserver._private.WOComponentContent.invokeAction(WOComponen
> tContent.java:31)
>
> at
> com.webobjects.appserver._private.WOComponentContent.invokeAction(WOComponen
> tContent.java:31)
>
> at
> com.webobjects.appserver._private.WODynamicGroup.invokeChildrenAction(WODyna
> micGroup.java:101)
>
> at
> com.webobjects.appserver._private.WODynamicGroup.invokeAction(WODynamicGroup
> .java:110)
>
> at
> com.webobjects.appserver._private.WOConditional.invokeAction(WOConditional.j
> ava:55)
>
> at
> com.webobjects.appserver._private.WODynamicGroup.invokeChildrenAction(WODyna
> micGroup.java:101)
>
> at
> com.webobjects.appserver._private.WODynamicGroup.invokeAction(WODynamicGroup
> .java:110)
>
> at com.webobjects.appserver.WOComponent.invokeAction(WOComponent.java:945)
>
> at
> com.webobjects.appserver._private.WOComponentReference.invokeAction(WOCompon
> entReference.java:104)
>
> at
> com.webobjects.appserver._private.WODynamicGroup.invokeChildrenAction(WODyna
> micGroup.java:101)
>
> at
> com.webobjects.appserver._private.WODynamicGroup.invokeAction(WODynamicGroup
> .java:110)
>
> at com.webobjects.appserver._private.WOForm.invokeAction(WOForm.java:82)
>
> at
> com.webobjects.appserver._private.WODynamicGroup.invokeChildrenAction(WODyna
> micGroup.java:101)
>
> at
> com.webobjects.appserver._private.WODynamicGroup.invokeAction(WODynamicGroup
> .java:110)
>
> at com.webobjects.appserver.WOComponent.invokeAction(WOComponent.java:945)
>
> at
> com.webobjects.appserver._private.WOComponentReference.invokeAction(WOCompon
> entReference.java:104)
>
> at
> com.webobjects.appserver._private.WODynamicGroup.invokeChildrenAction(WODyna
> micGroup.java:101)
>
> at
> com.webobjects.appserver._private.WODynamicGroup.invokeAction(WODynamicGroup
> .java:110)
>
> at com.webobjects.appserver.WOComponent.invokeAction(WOComponent.java:945)
>
> at
> com.webobjects.appserver._private.WOComponentReference.invokeAction(WOCompon
> entReference.java:104)
>
> at
> com.webobjects.appserver._private.WODynamicGroup.invokeChildrenAction(WODyna
> micGroup.java:101)
>
> at
> com.webobjects.appserver._private.WODynamicGroup.invokeAction(WODynamicGroup
> .java:110)
>
> at com.webobjects.appserver.WOComponent.invokeAction(WOComponent.java:945)
>
> at com.webobjects.appserver.WOSession.invokeAction(WOSession.java:1168)
>
> at
> com.webobjects.appserver.WOApplication.invokeAction(WOApplication.java:1375)
>
> at
> com.webobjects.appserver._private.WOComponentRequestHandler._dispatchWithPre
> paredPage(WOComponentRequestHandler.java:196)
>
> at
> com.webobjects.appserver._private.WOComponentRequestHandler._dispatchWithPre
> paredSession(WOComponentRequestHandler.java:287)
>
> at
> com.webobjects.appserver._private.WOComponentRequestHandler._dispatchWithPre
> paredApplication(WOComponentRequestHandler.java:322)
>
> at
> com.webobjects.appserver._private.WOComponentRequestHandler._handleRequest(W
> OComponentRequestHandler.java:358)
>
> at
> com.webobjects.appserver._private.WOComponentRequestHandler.handleRequest(WO
> ComponentRequestHandler.java:432)
>
> at
> com.webobjects.appserver.WOApplication.dispatchRequest(WOApplication.java:13
> 06)
>
> at
> com.webobjects.appserver._private.WOWorkerThread.runOnce(WOWorkerThread.java
> :173)
>
> at
> com.webobjects.appserver._private.WOWorkerThread.run(WOWorkerThread.java:254
> )
>
> at java.lang.Thread.run(Thread.java:595)
>
> -------------------------------------------------
>
>
>
This archive was generated by hypermail 2.0.0 : Thu Apr 20 2006 - 16:40:33 EDT