openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Oliver Ringel (JIRA)" <j...@apache.org>
Subject [jira] Commented: (OPENJPA-1787) Bean validation fails merging a new entity
Date Thu, 10 Mar 2011 17:37:59 GMT

    [ https://issues.apache.org/jira/browse/OPENJPA-1787?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13005193#comment-13005193
] 

Oliver Ringel commented on OPENJPA-1787:
----------------------------------------

Hi Rick,

this is the stack trace from my testcase.

2004  OpenJpaTestcase  TRACE  [main] openjpa.Runtime - An exception occurred while ending
the transaction.  This exception will be re-thrown.
<openjpa-2.2.0-SNAPSHOT-r422266:1078811 fatal store error> org.apache.openjpa.util.StoreException:
The transaction cannot be committed, because it was already marked for rollback only.  The
transaction will be rolled back instead. The cause of the rollback-only status is reported
in the embedded stack.
	at org.apache.openjpa.kernel.LocalManagedRuntime.commit(LocalManagedRuntime.java:89)
	at org.apache.openjpa.kernel.BrokerImpl.commit(BrokerImpl.java:1497)
	at org.apache.openjpa.kernel.DelegatingBroker.commit(DelegatingBroker.java:933)
	at org.apache.openjpa.persistence.EntityManagerImpl.commit(EntityManagerImpl.java:565)
	at testcase.openjpa.OpenJpaTest.testValidation(OpenJpaTest.java:24)
	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:597)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:76)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
	at org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:59)
	at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:115)
	at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:102)
	at org.apache.maven.surefire.Surefire.run(Surefire.java:180)
	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:597)
	at org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:350)
	at org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:1021)
Caused by: javax.validation.ConstraintViolationException: A validation constraint failure
occurred for class "testcase.openjpa.Person".
	at org.apache.openjpa.persistence.validation.ValidatorImpl.validate(ValidatorImpl.java:282)
	at org.apache.openjpa.validation.ValidatingLifecycleEventManager.fireEvent(ValidatingLifecycleEventManager.java:122)
	at org.apache.openjpa.kernel.BrokerImpl.fireLifecycleEvent(BrokerImpl.java:790)
	at org.apache.openjpa.kernel.BrokerImpl.persistInternal(BrokerImpl.java:2606)
	at org.apache.openjpa.kernel.BrokerImpl.persist(BrokerImpl.java:2544)
	at org.apache.openjpa.kernel.AttachStrategy.persist(AttachStrategy.java:95)
	at org.apache.openjpa.kernel.VersionAttachStrategy.attach(VersionAttachStrategy.java:102)
	at org.apache.openjpa.kernel.AttachManager.attach(AttachManager.java:251)
	at org.apache.openjpa.kernel.AttachManager.attach(AttachManager.java:104)
	at org.apache.openjpa.kernel.BrokerImpl.attach(BrokerImpl.java:3433)
	at org.apache.openjpa.kernel.DelegatingBroker.attach(DelegatingBroker.java:1214)
	at org.apache.openjpa.persistence.EntityManagerImpl.merge(EntityManagerImpl.java:873)
	at testcase.openjpa.OpenJpaTest.testValidation(OpenJpaTest.java:22)
	... 26 more


> Bean validation fails merging a new entity
> ------------------------------------------
>
>                 Key: OPENJPA-1787
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-1787
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: jpa, kernel
>    Affects Versions: 2.0.1, 2.1.0, 2.2.0
>            Reporter: Oliver Ringel
>            Assignee: Jeremy Bauer
>            Priority: Critical
>         Attachments: com.example.TestEmployeeDAO.txt, openjpa-1787.tar, testcase-openjpa-1787.tar
>
>
> The bean validation is not working correctly
> If you try to merge a new entity.
>         EntityManager em = entityManagerFactory.createEntityManager();
>         Person person = new Person();
>         person.setName("Oliver");                               // Employee.name is annotated
@NotNull 
>         person = em.merge(person);                            
> you get a ConstraintValidationException, although name is set. 

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message