It's my pleasure. Thanks Alex,Huang ----- Original Message ----- From: "Rick Curtis" <[email protected]> To: <[email protected]> Sent: Monday, November 08, 2010 10:17 PM Subject: Re: Can't obtain Primary Key value by JPQL
> Hopefully I'll find some time this afternoon to get that setup. In the > mean > time, could I get you to upload your Entity which was enhanced by the > plugin? > > Thanks, > Rick > > On Sun, Nov 7, 2010 at 11:38 AM, Alex, Huang <[email protected]> wrote: > >> Rick, >> >> I installed OpenJPA eclipse tooling on Eclipse 3.6... I think it's the >> reason. >> >> my environment: >> Eclipse: >> Version: 3.6.0.v20100602-9gF78GpqFt6trOGhL60z0oEx3fz-JKNwxPY >> Build id: I20100608-0911 >> Then I installed plug-in from >> http://openjpa.apache.org/openjpaeclipseinstallation.html and I used the >> tool for enhancement. >> >> Best regards, >> Alex,Huang >> >> ----- Original Message ----- >> From: "Rick Curtis" <[email protected]> >> To: <[email protected]> >> Sent: Saturday, November 06, 2010 2:43 AM >> Subject: Re: Can't obtain Primary Key value by JPQL >> >> >> > Can you point me to how you were enhancing your Entities... I'd like to >> > get >> > to the bottom of this one. >> > >> > Thanks, >> > Rick >> > >> > On Fri, Nov 5, 2010 at 12:18 AM, Alex, Huang <[email protected]> >> wrote: >> > >> >> Hi Rick, >> >> >> >> I got the reason. I always enhance entities by Eclipse plug-in. After >> >> got >> >> your clue, I enhanced entities again by using command. And the problem >> >> disappeared. >> >> >> >> Really thank you for all the help. >> >> Alex, Huang >> >> >> >> ----- Original Message ----- >> >> From: "Rick Curtis" <[email protected]> >> >> To: <[email protected]> >> >> Sent: Friday, November 05, 2010 1:20 AM >> >> Subject: Re: Can't obtain Primary Key value by JPQL >> >> >> >> >> >> > How are you enhancing your Entities? If you are using build time, >> >> > can >> >> > you >> >> > post the enhanced .class file? >> >> > >> >> > Thanks, >> >> > Rick >> >> > >> >> > On Wed, Nov 3, 2010 at 8:32 PM, Alex, Huang <[email protected]> >> >> wrote: >> >> > >> >> >> Hi Rick, >> >> >> >> >> >> >How did you get the data into your DB? >> >> >> I insert data at mysql prompt. >> >> >> ================================================ >> >> >> mysql> INSERT INTO t_user(name,age) VALUES ('John', 26); >> >> >> Query OK, 1 row affected (0.03 sec) >> >> >> ================================================ >> >> >> >> >> >> Now,db's data like below, >> >> >> ================================================ >> >> >> mysql> select * from t_user; >> >> >> +-----+--------+-----+ >> >> >> | uid | name | age | >> >> >> +-----+--------+-----+ >> >> >> | 1 | Huang | 26 | >> >> >> | 2 | Alex | 28 | >> >> >> | 3 | tester | 22 | >> >> >> | 4 | John | 26 | >> >> >> +-----+--------+-----+ >> >> >> 4 rows in set (0.00 sec) >> >> >> ================================================ >> >> >> >> >> >> >What happens if you call em.find(TUser.class, [known_id]) ? >> >> >> >> >> >> I run the following case, and it completed successful. >> >> >> ================================================ >> >> >> public void testFind(){ >> >> >> EntityManager em = emf.createEntityManager(); >> >> >> em.getTransaction().begin(); >> >> >> TUser user = em.find(TUser.class, 2); >> >> >> assertEquals("Alex", user.getName()); >> >> >> assertEquals(28, user.getAge()); >> >> >> } >> >> >> ================================================ >> >> >> >> >> >> After I added "assertEquals(2,user.getUid());", >> >> >> AssertionFailedError >> >> >> occured. >> >> >> ================================================ >> >> >> junit.framework.AssertionFailedError: expected:<2> but was:<0> >> >> >> ================================================ >> >> >> >> >> >> >Could you try creating some data and persisting it via JPA? >> >> >> OK.I added a method to test case. >> >> >> ========================================== >> >> >> public void testInsert(){ >> >> >> EntityManager em = emf.createEntityManager(); >> >> >> em.getTransaction().begin(); >> >> >> TUser user = new TUser(); >> >> >> user.setName("Jeason"); >> >> >> user.setAge(27); >> >> >> em.persist(user); >> >> >> em.getTransaction().commit(); >> >> >> em.close(); >> >> >> } >> >> >> ========================================== >> >> >> >> >> >> I run the test case and it completed successful. At mysql prompt I >> >> >> confirmed >> >> >> the data has been created. >> >> >> >> >> >> ========================================== >> >> >> mysql> select * from t_user; >> >> >> +-----+--------+-----+ >> >> >> | uid | name | age | >> >> >> +-----+--------+-----+ >> >> >> | 1 | Huang | 26 | >> >> >> | 2 | Alex | 28 | >> >> >> | 3 | tester | 22 | >> >> >> | 4 | John | 26 | >> >> >> | 5 | Jeason | 27 | >> >> >> +-----+--------+-----+ >> >> >> 5 rows in set (0.00 sec) >> >> >> ========================================== >> >> >> >> >> >> Look forward to your advance. >> >> >> Alex,Huang >> >> >> ----- Original Message ----- >> >> >> From: "Rick Curtis" <[email protected]> >> >> >> To: <[email protected]> >> >> >> Sent: Thursday, November 04, 2010 5:29 AM >> >> >> Subject: Re: Can't obtain Primary Key value by JPQL >> >> >> >> >> >> >> >> >> > That looks about identical to the test case that I came up with. >> >> >> > >> >> >> >> Any advice? >> >> >> > I'm running low on ideas here... How did you get the data into >> your >> >> >> > DB? >> >> >> > What happens if you call em.find(TUser.class, [known_id]) ? Could >> >> >> > you >> >> >> > try >> >> >> > creating some data and persisting it via JPA? >> >> >> > >> >> >> > Thanks, >> >> >> > Rick >> >> >> > >> >> >> >> >> >> >> >> >> >> >> > >> >> >> >> >> >> >> > >> >> >> > begin 666 TUser.zip M4$L#!!0````(`,JZ:#UFN'\X< P``(T>```+````5%5S97(N8VQA<W.M60EX M6\41GM5AV<ISXLAQ?,?D<' DVR('X<B%H]A!P3BIY00<M\"+]&*_($NJ]$1B M2J&E*11:>I>6EJ.TT%":MK9#')L`H5>@M/0NO>E]7[3T/J SN_N>#C\[\?<U MWV<][>X_,__,SLSN4YYYZ=$G`& -"WO P4#1$H9NC 3[=F>TM =<#"H.J->I MP;B:& SNW'= BQH>*&&PB,_JR6!$2^MJ7+]>W1?7$)SAPSU:.J,G$[O#VQBP M'0S*0\E$QE 3QAXUGM7<(/XQ!LZL'D-(F$%M;Q8M#VM[](R.JCH2B:2A&j...@d MPV!Q-UD[%$R1VHRA):):,!S;P&"9S<)V+:&E54.+<5L(*LT8-!X<F16/EOI& M4AP?WM;9TQ?NZV=09X,/)>/9X03BO'H"O37(<2=W!YSJ(,; E5"'\>'k...@4n M8J3UQ"#*E&S4$[JQ&:$m...@-)2,:5YPPA(%ZJ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