openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "B.L. Zeebub" <roger.var...@googlemail.com>
Subject Re: [NEWBIE] OpenJPA Cannot get id field returned
Date Wed, 09 Sep 2009 11:07:33 GMT



ashishpaliwal wrote:
> 
> //@Test
>        public void getPEcuByPlatformById() {
>                Platform platform = (Platform) em.find(Platform.class, 1);
>                Set<PEcu> set = platform.getPecus();
>                assertEquals("PEcu count:",27,set.size());
>        }
> 
> Even in this case I believe since this is a lazy relation, upon execution
> of
> paltform.getPecus() another query for pecus will have to be fired and at
> that time Platform.getId() will be called. You can check this by setting
> breakpoints.
> The problem is same I believe that getId() is returning 0, thta is why set
> is also null in this case.
> Try changing GenerationType to Sequence or may be .java file definition to
> long id and database type to bigint.
> 
> I am just trying so might be wrong as well :)
> 

OK I've changed the database definition of Platform to BIGINT and re-created
the .java entities from the
table definitions. First problem - the entity creation tool defined the
.java id's as String! Changed the .java definitions to long and it makes no
difference whatsoever.

Regards

-- 
View this message in context: http://n2.nabble.com/NEWBIE-OpenJPA-Cannot-get-id-field-returned-tp3601995p3610062.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

Mime
View raw message