• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

CompositeID Query..

 
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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..
 
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic