Tom Beerbower created AMBARI-6019:
-------------------------------------

             Summary: Views : JPA Exception installing view
                 Key: AMBARI-6019
                 URL: https://issues.apache.org/jira/browse/AMBARI-6019
             Project: Ambari
          Issue Type: Task
            Reporter: Tom Beerbower
            Assignee: Tom Beerbower
             Fix For: 1.6.1


Get the following exception if views are deployed, then restart with new view 
in views folder. The new view fails to deploy with the following ...

javax.persistence.RollbackException: Exception EclipseLink-7251 (Eclipse 
Persistence Services - 2.4.0.v20120608-): 
org.eclipse.persistence.exceptions.ValidationException
Exception Description: The attribute view of class 
org.apache.ambari.server.orm.entities.ViewInstanceEntity is mapped to a primary 
key column in the database. Updates are not allowed.

The exception only happens if a new instance of one of the initial views is 
created through the REST API before the server is restarted and the new view 
deployed.

It turns out that there is an issue when the views are being setup in the 
registry.  Any instance that is not present in the archive but exists in the 
Ambari db is bound to the registry view and added to the registry.  The problem 
is that the instance being added to the registry is still bound to the entity 
manager.  Since the registry view is a different instance of a ViewEntity, JPA 
complains because you can't change the PK of the instance.

The strange part is that the exception is not reported right away.  Instead it 
get thrown on the commit from the AmbariJpaLocalTxnInterceptor when a totally 
different view is being created in the db. 



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

Reply via email to