• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

OJB - Mapping a table w/o Primary Key

 
Mathieu Riendeau
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there,

My problem is really simple.

How do I map an object to a table without primary key? Because OJB requires at least 1 primary key.

Thx

Mathieu Riendeau
mriendea@ca.ibm.com
 
Dave Clark
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
why would you want to have a table without a primary key?? primary keys are kinda one of the underpinnings of relational database theory...

how would your persistence layer know which row to update if you fetched an object, changed it's value, and wanted the changes to be persisted? You need a unique identifier for this - i.e. a primary key on the table.

Or are you actually asking a question about JDO's facilities for application identity (ID's visible to the app), versus datastore identity (IDs managed by the JDO runtime, but still stored as primary keys in an RDBMS).

cheers,

Dave
 
Gobind Singh
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I also have the same question. Is it possible to use hibernate mapping to insert into a table that does not have a primary key defined??
 
Ghulam Rashid
Ranch Hand
Posts: 278
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Look into this thread regarding PK.
Hibernate supports for PK
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic