openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alex, Huang" <primemo...@gmail.com>
Subject Re: Can't obtain Primary Key value by JPQL
Date Wed, 03 Nov 2010 20:18:24 GMT
Hi Rick,

I wrote a small test case like below,
==START======================================================================
public class TestQuery extends SingleEMFTestCase {
 public void setUp() throws Exception {
  // registers TUser as persistence-capable entity
  super.setUp(TUser.class);
 }
 public void tearDown() throws Exception {
      //
 }
 public void testFind(){
  EntityManager em = emf.createEntityManager();
  em.getTransaction().begin();
  Query query = em.createQuery("SELECT user FROM TUser user",TUser.class);
  List<TUser> result = query.getResultList();
  for( TUser entity: result){
   assertNotEquals(0, entity.getUid());
  }
 }
 public static void main(String[] args) {
  TestRunner.run(TestQuery.class);
 }
}
==END========================================================================

And I got following error,

junit.framework.AssertionFailedError: expected args to be different; were 
the same instance.

Any advice?

Alex,Huang

>> ----- Original Message -----
>> From: "Rick Curtis" <curtisr7@gmail.com>
>> To: <users@openjpa.apache.org>
>> Sent: Thursday, November 04, 2010 2:30 AM
>> Subject: Re: Can't obtain Primary Key value by JPQL
>>
>>
>> > Honesty, I don't have a clue why this isn't working for you. I have
>> > unsuccessfully tried to recreate this problem on both 2.0.x and trunk.
>> >
>> > Is it possible that you could write a small unit test to recreate the
>> > problem?
>> >
>> > Thanks,
>> > Rick
>> >
>>
>>
>>
> 



Mime
View raw message