wood burning stoves 2.0*
The moose likes Object Relational Mapping and the fly likes How can I use many-to-one without foreign-key Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "How can I use many-to-one without foreign-key" Watch "How can I use many-to-one without foreign-key" New topic
Author

How can I use many-to-one without foreign-key

Gajen Pingalkar
Ranch Hand

Joined: Aug 29, 2006
Posts: 37
Hi All,
How can I use many-to-one with unique column, that column is not foreign-key. Here is a code,

Now If I don't have "gdm_id" as a foreign-key, it only a unique column. Then how could I map to Department unique column.

Thanks & Regards,
Gajen
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17249
    
    6

I don't see the use of foreign-key in many-to-one in this from the Hibernate docs pages.

http://www.hibernate.org/hib_docs/v3/reference/en/html/associations.html#assoc-unidirectional-m21

It seems it is just using some column not a specific FK field.

Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How can I use many-to-one without foreign-key
 
Similar Threads
question about Enity mapping
Special Association Mapping in Hibernate
Foreig key must have same number of columns as the referenced primary key
Composite key as foreign key problem.
Hibernate one-to-one mapping with foreign key