Entities by definition require an id, or primary key. OpenJPA provides a DataStore ID mechanism [1] which provides a surrogate key instead of an explicit primary key declaration, but to be honest, this is not used all that often.
How are these other tables used? Are the values in these non-primary key tables used by other Entities? Maybe the ElementCollection and/or CollectionTable annotations are applicable to your situation. The Reverse Mapping tools for generating Entity classes are meant to give you a starting point. The classes that are generated should give you a good basis, but tweaks will undoubtedly be required to complete your O/R Mapping. Kevin [1] http://openjpa.apache.org/builds/latest/docs/manual/manual.html#ref_guide_pc_oid_datastore On Mon, May 2, 2011 at 2:06 PM, Rick Curtis <[email protected]> wrote: > Have you tried creating your Entities by hand and see how OpenJPA handles > them at runtime? > > Thanks, > Rick > > On Fri, Apr 29, 2011 at 5:26 PM, chintan4181 <[email protected]> > wrote: > > > Hi, > > > > In my existing db schema, i have few look tables which doesnt have > primary > > key defined. When i generate entities from tables, i am getting error > > saying > > "Every entity must have primary key". Since this is exisitng schema, i > dont > > want to change these tables. > > > > is there a way to avoid these error? > > > > Thanks > > chintan- >
