• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

what happen when a table haven't Primary Key?

 
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
As EJB's specifiction described, all Entity Bean must have a primary key to uniquely identify a data row in database, but facing a table wihtout primary key, how do entity bean identify the data from database? and how do i deploy the prim-key-class attrubite of the XML description file?

thanks in advanced,
Along
 
Ranch Hand
Posts: 273
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Entity Bean should have a primary key. Even if your table does not have primary key, it does not matter. What happens in this case is that it will retrieve more than one records which satisfy the key.

The prim-key-class can be either the wrappers to primitive or your own Primary Key class.

Thanks,
Guru
 
Along huang
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Since it haven't primary key, of course I don't know what data type it is,
so, it is impossible to fill out the prim-key-class.

How can I do?
thanks
 
Gurumurthy Ramamurthy
Ranch Hand
Posts: 273
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
EJB2.0 defers primary key till the deployment time.
So, if you don't know the type, still you can declare as java.lang.Object as prim-key-class.

thanks,
Guru
 
I think I'll just lie down here for a second. And ponder this tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic