• 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:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

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
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic