Hi,
I upgrade with below steps:
- modify cuba version in build.gradle.
- assemble
- run createDB task with new DB.
- start server
1 2 3 all go well but while start server, I see below error everytime,
com.haulmont.cuba.core.sys.AbstractWebAppContextLoader - Error initializing application
javax.persistence.PersistenceException: Exception [EclipseLink-7251] (Eclipse Persistence Services - 2.6.2.cuba24): org.eclipse.persistence.exceptions.ValidationException
Exception Description: The attribute [id] of class [cn.com.dataocean.cip.entity.CipUser] is mapped to a primary key column in the database. Updates are not allowed.
at org.eclipse.persistence.internal.jpa.EntityManagerImpl.flush(EntityManagerImpl.java:883) ~[eclipselink-2.6.2.cuba24.jar:2.6.2.cuba24]
at com.haulmont.cuba.core.sys.persistence.PersistenceImplSupport$ContainerResourceSynchronization.detachAll(PersistenceImplSupport.java:496) ~[cuba-core-6.10.3.jar:6.10.3]
at com.haulmont.cuba.core.sys.persistence.PersistenceImplSupport$ContainerResourceSynchronization.beforeCommit(PersistenceImplSupport.java:449) ~[cuba-core-6.10.3.jar:6.10.3]
at org.springframework.transaction.support.TransactionSynchronizationUtils.triggerBeforeCommit(TransactionSynchronizationUtils.java:95) ~[spring-tx-4.3.18.RELEASE.jar:4.3.18.RELEASE]
at org.springframework.transaction.support.AbstractPlatformTransactionManager.triggerBeforeCommit(AbstractPlatformTransactionManager.java:936) ~[spring-tx-4.3.18.RELEASE.jar:4.3.18.RELEASE]
at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:748) ~[spring-tx-4.3.18.RELEASE.jar:4.3.18.RELEASE]
at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:734) ~[spring-tx-4.3.18.RELEASE.jar:4.3.18.RELEASE]
at com.haulmont.cuba.core.sys.TransactionImpl.commit(TransactionImpl.java:104) ~[cuba-core-6.10.3.jar:6.10.3]
at com.haulmont.cuba.security.auth.AuthenticationManagerBean.login(AuthenticationManagerBean.java:120) ~[cuba-core-6.10.3.jar:6.10.3]
at com.haulmont.cuba.security.auth.AnonymousSessionHolder.loginAnonymous(AnonymousSessionHolder.java:82) ~[cuba-core-6.10.3.jar:6.10.3]
at com.haulmont.cuba.security.auth.AnonymousSessionHolder.initializeAnonymousSession(AnonymousSessionHolder.java:72) ~[cuba-core-6.10.3.jar:6.10.3]
at com.haulmont.cuba.security.auth.AnonymousSessionHolder.applicationStarted(AnonymousSessionHolder.java:45) ~[cuba-core-6.10.3.jar:6.10.3]
at com.haulmont.cuba.core.sys.AppContext.startContext(AppContext.java:239) ~[cuba-global-6.10.3.jar:6.10.3]
at com.haulmont.cuba.core.sys.AppContext$Internals.startContext(AppContext.java:302) ~[cuba-global-6.10.3.jar:6.10.3]
at com.haulmont.cuba.core.sys.AbstractWebAppContextLoader.contextInitialized(AbstractWebAppContextLoader.java:85) ~[cuba-global-6.10.3.jar:6.10.3]
Caused by: org.eclipse.persistence.exceptions.ValidationException:
Exception Description: The attribute [id] of class [cn.com.dataocean.cip.entity.CipUser] is mapped to a primary key column in the database. Updates are not allowed.
at org.eclipse.persistence.exceptions.ValidationException.primaryKeyUpdateDisallowed(ValidationException.java:2551) ~[eclipselink-2.6.2.cuba24.jar:2.6.2.cuba24]
at org.eclipse.persistence.mappings.foundation.AbstractDirectMapping.writeFromObjectIntoRowWithChangeRecord(AbstractDirectMapping.java:1298) ~[eclipselink-2.6.2.cuba24.jar:2.6.2.cuba24]
at org.eclipse.persistence.internal.descriptors.ObjectBuilder.buildRowForUpdateWithChangeSet(ObjectBuilder.java:1769) ~[eclipselink-2.6.2.cuba24.jar:2.6.2.cuba24]
at org.eclipse.persistence.internal.queries.DatabaseQueryMechanism.updateObjectForWriteWithChangeSet(DatabaseQueryMechanism.java:1030) ~[eclipselink-2.6.2.cuba24.jar:2.6.2.cuba24]
at org.eclipse.persistence.queries.UpdateObjectQuery.executeCommitWithChangeSet(UpdateObjectQuery.java:84) ~[eclipselink-2.6.2.cuba24.jar:2.6.2.cuba24]
at org.eclipse.persistence.internal.queries.DatabaseQueryMechanism.executeWriteWithChangeSet(DatabaseQueryMechanism.java:301) ~[eclipselink-2.6.2.cuba24.jar:2.6.2.cuba24]
at org.eclipse.persistence.queries.WriteObjectQuery.executeDatabaseQuery(WriteObjectQuery.java:58) ~[eclipselink-2.6.2.cuba24.jar:2.6.2.cuba24]
at org.eclipse.persistence.queries.DatabaseQuery.execute(DatabaseQuery.java:904) ~[eclipselink-2.6.2.cuba24.jar:2.6.2.cuba24]
at org.eclipse.persistence.queries.DatabaseQuery.executeInUnitOfWork(DatabaseQuery.java:803) ~[eclipselink-2.6.2.cuba24.jar:2.6.2.cuba24]
at org.eclipse.persistence.queries.ObjectLevelModifyQuery.executeInUnitOfWorkObjectLevelModifyQuery(ObjectLevelModifyQuery.java:108) ~[eclipselink-2.6.2.cuba24.jar:2.6.2.cuba24]
at org.eclipse.persistence.queries.ObjectLevelModifyQuery.executeInUnitOfWork(ObjectLevelModifyQuery.java:85) ~[eclipselink-2.6.2.cuba24.jar:2.6.2.cuba24]
at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.internalExecuteQuery(UnitOfWorkImpl.java:2944) ~[eclipselink-2.6.2.cuba24.jar:2.6.2.cuba24]
at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1854) ~[eclipselink-2.6.2.cuba24.jar:2.6.2.cuba24]
at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1836) ~[eclipselink-2.6.2.cuba24.jar:2.6.2.cuba24]
at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1787) ~[eclipselink-2.6.2.cuba24.jar:2.6.2.cuba24]
at org.eclipse.persistence.internal.sessions.CommitManager.commitChangedObjectsForClassWithChangeSet(CommitManager.java:273) ~[eclipselink-2.6.2.cuba24.jar:2.6.2.cuba24]
at org.eclipse.persistence.internal.sessions.CommitManager.commitAllObjectsWithChangeSet(CommitManager.java:131) ~[eclipselink-2.6.2.cuba24.jar:2.6.2.cuba24]
at org.eclipse.persistence.internal.sessions.AbstractSession.writeAllObjectsWithChangeSet(AbstractSession.java:4260) ~[eclipselink-2.6.2.cuba24.jar:2.6.2.cuba24]
at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.commitToDatabase(UnitOfWorkImpl.java:1446) ~[eclipselink-2.6.2.cuba24.jar:2.6.2.cuba24]
at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.commitToDatabaseWithPreBuiltChangeSet(UnitOfWorkImpl.java:1592) ~[eclipselink-2.6.2.cuba24.jar:2.6.2.cuba24]
at org.eclipse.persistence.internal.sessions.RepeatableWriteUnitOfWork.writeChanges(RepeatableWriteUnitOfWork.java:455) ~[eclipselink-2.6.2.cuba24.jar:2.6.2.cuba24]
at org.eclipse.persistence.internal.jpa.EntityManagerImpl.flush(EntityManagerImpl.java:878) ~[eclipselink-2.6.2.cuba24.jar:2.6.2.cuba24]
... 27 common frames omitted
I extended sec$user to cip$user, and it works in cuba6.9.5.
I have below setting in app.properties:
cuba.anonymousSessionId = e90549a2-ea77-1e91-b049-bd703fda4420
I see in the createDB, it has anonymous user uuid as a405db59-e674-4f63-8afe-269dda788fe8, but even I change cuba.anonymousSessionId to a405db59-e674-4f63-8afe-269dda788fe8, I still see the error.
Any clue can help me?
Thanks~