• Post Reply Bookmark Topic Watch Topic
  • New Topic

Mapping to a table which does not have a primary key

 
vijin das
Ranch Hand
Posts: 129
Firefox Browser Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am Having A table which is not having a primary key ....

how can i map this table using hibernate ...

what i have to give for the ID attribute in the hibernate mapping file ...

please give a solultion...

Thanks in Advance
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
An entity without a primary key in a relational database is invalid. If you can you should add a surrogate key to it. If you can't you can map every field as a composite key, though this will mean your entity can't support duplicates any more.
 
vijin das
Ranch Hand
Posts: 129
Firefox Browser Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks .....for your advice ...Will you please give more info about ...that
thanks in Advance
 
Bosun Bello
Ranch Hand
Posts: 1511
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'd suggest you search on the keywords in Paul's post above. That will get you going. As he said, though, your table needs to have a primary key.

vijin das wrote:Thanks .....for your advice ...Will you please give more info about ...that
thanks in Advance
 
A timing clock, fuse wire, high explosives and a tiny ad:
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!