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" <[email protected]>
>> To: <[email protected]>
>> 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
>> >
>>
>>
>>
>