This week's book giveaway is in the HTML Pages with CSS and JavaScript forum.
We're giving away four copies of Testing JavaScript Applications and have Lucas da Costa on-line!
See this thread for details.
Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • 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
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

OJB - Mapping a table w/o Primary Key

 
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
 
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
 
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??
 
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
 
straws are for suckers. tiny ads are for attractive people.
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic