-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: many-to-one on non-primary-key column using annotation?
PostPosted: Mon Apr 03, 2006 11:23 pm 
Newbie

Joined: Fri Apr 29, 2005 11:55 pm
Posts: 14
Location: China-Australia
For a normal many-to-one, I can just do
Code:
public class FirmUser implements Serializable{
   private Login logn;

   @ManyToOne(fetch = FetchType.LAZY)
   @JoinColumn(name = "username")
   public Login getLogin() {
      return login;
   }

   public void setLogin(Login login){
      this.login = login;
   }


The above mapping would use the primary key column of Login entity. However, what if I want it to be mapped to another column in Login, how could I do that?

I think we can achivev that with mapping files, but not sure if it's possible with hibernate annotation.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.