-->
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: OneToOne Entity primary key as key...
PostPosted: Wed Sep 21, 2005 2:54 pm 
Regular
Regular

Joined: Wed Sep 21, 2005 1:37 pm
Posts: 53
Location: Montpellier - France
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version:

Mapping documents:

Code between sessionFactory.openSession() and session.close():

Full stack trace of any exception that occurs:

Name and version of the database you are using:

The generated SQL (show_sql=true):

Debug level Hibernate log excerpt:

Hello,

I want to use the primary key of an entity as primary key, like :

Code:
@Id(generate = GeneratorType.NONE)
@NotNull
@OneToOne(fetch = FetchType.LAZY, targetEntity = Company.class)
@JoinColumn(name = "details_id", nullable = false, unique = true)
public ICompany getCompany() throws RemoteException {
return company;
}

public void setCompany(ICompany o) throws RemoteException {
company = o;
}



but with this code, hibernate use the 'ICompany' value and not it's primary key.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 22, 2005 6:26 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
An id cannot be an association in this release, sorry.

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 22, 2005 7:12 am 
Regular
Regular

Joined: Wed Sep 21, 2005 1:37 pm
Posts: 53
Location: Montpellier - France
Thanks, Merci,

I think I will use inheritance for this type.


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.