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

Amy Yang commented on OPENJPA-1092:
-----------------------------------

Hi Michael,
The error on 1.1.x is like:
Tests run: 5, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 18.453 sec <<< 
FAILURE!
testSetFirstResults(org.apache.openjpa.persistence.jpql.clauses.TestEJBQueryInterface)
  Time elapsed: 0.359 sec  <<< FAILURE!
junit.framework.ComparisonFailure: expected:<...3> but was:<...0>
        at junit.framework.Assert.assertEquals(Assert.java:81)
        at junit.framework.Assert.assertEquals(Assert.java:87)
        at 
org.apache.openjpa.persistence.jpql.clauses.TestEJBQueryInterface.testSetFirstResults(TestEJBQueryInterface.java:124)
        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 junit.framework.TestCase.runTest(TestCase.java:154)
        at junit.framework.TestCase.runBare(TestCase.java:127)
        at junit.framework.TestResult$1.protect(TestResult.java:106)
        at junit.framework.TestResult.runProtected(TestResult.java:124)
        at junit.framework.TestResult.run(TestResult.java:109)
        at junit.framework.TestCase.run(TestCase.java:118)
        at 
org.apache.openjpa.persistence.test.PersistenceTestCase.run(PersistenceTestCase.java:127)
        at junit.framework.TestSuite.runTest(TestSuite.java:208)
        at junit.framework.TestSuite.run(TestSuite.java:203)
        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 
org.apache.maven.surefire.junit.JUnitTestSet.execute(JUnitTestSet.java:213)
        at 
org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:140)
        at 
org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:127)
        at org.apache.maven.surefire.Surefire.run(Surefire.java:177)
        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 
org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:334)
        at 
org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:980)

the insertion order seems random so the error changes every time.

I also tried on trunk but can't reproduce the error. Do we maintain the order 
of the creation of java instances somewhere? 


> enable test case for jpql
> -------------------------
>
>                 Key: OPENJPA-1092
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-1092
>             Project: OpenJPA
>          Issue Type: Test
>          Components: jdbc
>    Affects Versions: 1.1.0
>         Environment: OS: windows XP professional 
> java version 1.5.0_14 
>            Reporter: Amy Yang
>            Priority: Minor
>         Attachments: OPENJPA-1092.patch
>
>
> Currently TestEJBQueryInterface is excluded.
> To enable it, just a little change is needed: invoking em.flush() after every 
> em.persist().
> The test case wants to get the result depends on the order of the creation of 
> the entity instance. but we (as well as most other JPA implementations) don't 
> care about the creation order of java instances because the insertion happens 
> when the transaction is committed or flush is invoked. So adding "em.flush()" 
> after "em.persist()" will resolve the problem.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to