-->
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.  [ 3 posts ] 
Author Message
 Post subject: Foreign column name
PostPosted: Mon Aug 28, 2006 10:29 am 
Newbie

Joined: Mon Aug 28, 2006 10:05 am
Posts: 2
Is it possible to define name for foreign key column? By default generated name is [fk_table]_id. I would like to get fk_[fk_table]. I've tried:

Code:
class User
{
    ...
    @Column (name="FK_CITY")
    @ManyToOne (targetEntity="City.class")
    private City city;
    ...   
}


but @Column annotation has no effect. I've read http://opensource.atlassian.com/project ... se/ANN-261 too, but if I understand correctly it is related to constraint name, not column name.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 29, 2006 4:02 am 
Newbie

Joined: Sun Aug 06, 2006 8:54 am
Posts: 15
Try @JoinColumn(name="fk_city") instead of @Column

Code:
class User
{
    ...
    @ManyToOne (targetEntity="City.class")
    @JoinColumn(name="fk_city")
    private City city;
    ...   
}


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 30, 2006 3:58 am 
Newbie

Joined: Mon Aug 28, 2006 10:05 am
Posts: 2
I missed that one ;-). Thx.


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

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.