Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

CompositeID Query..

 
Shridhar. Blr.
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I have a table [Trading Partners]



Is the following TradingPartner.hbm.xml is correct??



Please correct me, if i somthing is missing..

Also is it necessary to have <id> element in .hbm.xml file..

<id name="id" column="uid" type="long">
<generator class="hilo"/>
</id>


I may not need a column, which is auto generated..

If its there, how can i give my own value, [unique key which i would want to generate/set] & not hibernate's <generator> node.

All the required values for each of the column will be set in code/application..

Any help would be highly appreciated..
Thanks in Advance.
/Shridhar..
 
Sebastian Hennebrueder
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
composite-id replaces id
but I would recommend to use an generic primary key instead of a composite id beeing composed of so many columns. Do not forget that each entity having a relation to your mapping must have each column in the mapping configuration.

You can read more about generators for primary keys in the Hibernate Reference.

Regards Sebastian
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic