-->
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.  [ 11 posts ] 
Author Message
 Post subject: named primary key
PostPosted: Fri Feb 29, 2008 9:55 am 
Beginner
Beginner

Joined: Thu Feb 28, 2008 4:58 am
Posts: 37
Hello
Is it possible to name primary key?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 07, 2008 5:19 am 
Beginner
Beginner

Joined: Thu Feb 28, 2008 4:58 am
Posts: 37
simple "yes" or "no" would be enough...


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 07, 2008 1:25 pm 
Beginner
Beginner

Joined: Wed Nov 21, 2007 8:04 am
Posts: 27
Maybe.

(Depends on what you mean by "name".)


Top
 Profile  
 
 Post subject:
PostPosted: Mon Mar 17, 2008 3:27 am 
Beginner
Beginner

Joined: Thu Feb 28, 2008 4:58 am
Posts: 37
Actually primary keys have names in database like SYS_C0012134
I would like to chamge this name to something like PK_USER


Top
 Profile  
 
 Post subject:
PostPosted: Mon Mar 17, 2008 9:52 am 
Beginner
Beginner

Joined: Wed Nov 21, 2007 8:04 am
Posts: 27
Yes, you can. The reference documentation for hibernate tells you how.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 20, 2008 5:11 am 
Beginner
Beginner

Joined: Thu Feb 28, 2008 4:58 am
Posts: 37
Is it possible to name primary key via annotation? if yes, please give me name of this annotation. I didn't found anything about naming primary key in
http://www.hibernate.org/hib_docs/annotations/reference/en/html_single/#d0e1659


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 20, 2008 5:48 am 
Regular
Regular

Joined: Thu Oct 13, 2005 4:19 am
Posts: 98
This should work:

@Column(name="myId")
@Id

_________________
http://www.ohloh.net/accounts/ge0ffrey


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 21, 2008 8:48 am 
Beginner
Beginner

Joined: Thu Feb 28, 2008 4:58 am
Posts: 37
I don't want name column but primary key...


Top
 Profile  
 
 Post subject:
PostPosted: Mon Mar 24, 2008 1:59 pm 
Newbie

Joined: Tue Oct 26, 2004 4:29 pm
Posts: 7
Location: Brazil
HI, I'm Having the same problem.

To name a Foreign Key I put the:
@ForeignKey(name="FK_USER")

But how to do this with Primary Key ?

I Know how to change the field name of my ID, is using @column, but I need change the name of constraint of my Primary Key, the name is generated like this: SYS_(SOMETHING), but I need something like this "PK_USER"

_________________
MRMeneghette


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 27, 2008 4:50 am 
Beginner
Beginner

Joined: Thu Feb 28, 2008 4:58 am
Posts: 37
this subject is one month old and still no solution, so I think the answer is: NO
Can we add somewhere feature request?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 28, 2008 3:01 am 
Regular
Regular

Joined: Thu Oct 13, 2005 4:19 am
Posts: 98
Take a look through hibernate JIRA.
The's definitly an issue about the ability to name @UniqueConstraint annotations - and that's possible with hbm.xml

_________________
http://www.ohloh.net/accounts/ge0ffrey


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 11 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.