Tom Beerbower created AMBARI-6230:
-------------------------------------

             Summary: Views: updates after POST to create cause exceptions
                 Key: AMBARI-6230
                 URL: https://issues.apache.org/jira/browse/AMBARI-6230
             Project: Ambari
          Issue Type: Task
            Reporter: Tom Beerbower
            Assignee: Tom Beerbower
             Fix For: 1.6.1


After creating the view POST, then i PUT to change props, like label, 
description, etc. Those changes cause an exception. Even with the exception 
happening, changes happen (I can see them after I use the REST api) but the 
changes are not persisted (they disappear after a ambari-server restart). 

{code}
{
  "status": 500,
  "message": "Exception [EclipseLink-7251] (Eclipse Persistence Services - 
2.4.0.v20120608-r11652): 
org.eclipse.persistence.exceptions.ValidationException\nException Description: 
The attribute [viewInstance] of class 
[org.apache.ambari.server.orm.entities.ViewInstancePropertyEntity] is mapped to 
a primary key column in the database. Updates are not allowed."
}
{code}

{code}
Caused by: Exception [EclipseLink-7251] (Eclipse Persistence Services - 
2.4.0.v20120608-r11652): org.eclipse.persistence.exceptions.ValidationException
Exception Description: The attribute [viewInstance] of class 
[org.apache.ambari.server.orm.entities.ViewInstancePropertyEntity] is mapped to 
a primary key column in the database. Updates are not allowed.
        at 
org.eclipse.persistence.exceptions.ValidationException.primaryKeyUpdateDisallowed(ValidationException.java:2458)
        at 
org.eclipse.persistence.mappings.OneToOneMapping.writeFromObjectIntoRowWithChangeRecord(OneToOneMapping.java:1891)
        at 
org.eclipse.persistence.internal.descriptors.ObjectBuilder.buildRowForUpdateWithChangeSet(ObjectBuilder.java:1378)
        at 
org.eclipse.persistence.internal.queries.DatabaseQueryMechanism.updateObjectForWriteWithChangeSet(DatabaseQueryMechanism.java:1003)
        at 
org.eclipse.persistence.queries.UpdateObjectQuery.executeCommitWithChangeSet(UpdateObjectQuery.java:84)
        at 
org.eclipse.persistence.internal.queries.DatabaseQueryMechanism.executeWriteWithChangeSet(DatabaseQueryMechanism.java:286)
        at 
org.eclipse.persistence.queries.WriteObjectQuery.executeDatabaseQuery(WriteObjectQuery.java:58)
        at 
org.eclipse.persistence.queries.DatabaseQuery.execute(DatabaseQuery.java:852)
        at 
org.eclipse.persistence.queries.DatabaseQuery.executeInUnitOfWork(DatabaseQuery.java:751)
        at 
org.eclipse.persistence.queries.ObjectLevelModifyQuery.executeInUnitOfWorkObjectLevelModifyQuery(ObjectLevelModifyQuery.java:108)
        at 
org.eclipse.persistence.queries.ObjectLevelModifyQuery.executeInUnitOfWork(ObjectLevelModifyQuery.java:85)
        at 
org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.internalExecuteQuery(UnitOfWorkImpl.java:2875)
        at 
org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1602)
        at 
org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1584)
        at 
org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1535)
        at 
org.eclipse.persistence.internal.sessions.CommitManager.commitChangedObjectsForClassWithChangeSet(CommitManager.java:265)
        at 
org.eclipse.persistence.internal.sessions.CommitManager.commitAllObjectsForClassWithChangeSet(CommitManager.java:190)
        at 
org.eclipse.persistence.internal.sessions.CommitManager.commitAllObjectsWithChangeSet(CommitManager.java:136)
        at 
org.eclipse.persistence.internal.sessions.AbstractSession.writeAllObjectsWithChangeSet(AbstractSession.java:3914)
        at 
org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.commitToDatabase(UnitOfWorkImpl.java:1419)
        at 
org.eclipse.persistence.internal.sessions.RepeatableWriteUnitOfWork.commitToDatabase(RepeatableWriteUnitOfWork.java:634)
        at 
org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.commitToDatabaseWithChangeSet(UnitOfWorkImpl.java:1509)
        at 
org.eclipse.persistence.internal.sessions.RepeatableWriteUnitOfWork.commitRootUnitOfWork(RepeatableWriteUnitOfWork.java:266)
        at 
org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.commitAndResume(UnitOfWorkImpl.java:1147)
        at 
org.eclipse.persistence.internal.jpa.transaction.EntityTransactionImpl.commitInternal(EntityTransactionImpl.java:84)
        ... 91 more
{code}



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to