-->
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 with composite key inside a composite-key
PostPosted: Mon Sep 18, 2006 11:15 am 
Newbie

Joined: Mon Jun 20, 2005 11:07 am
Posts: 16
Hi everyone
I'm trying to add with XDoclet a many-to-one relationship that has a compositekey, but is inside a composite key.
How can I achieve such a thing? It's possible to do such thing with a hibernate-properties-<PojoName>.xml in the merge dir, like it's needed to do with common many-to-one associations that have composite keys? If so, does anyone have a running example for this?
Í'm using something like the code above, but I'm not too sure about if it's working or not (I don't have queries that uses this compositekey yet).

ExampleKey.java
Code:
/**
* Test attribute associated.
*/
private Test test;
   
/**
* Test2 attribute associated, that has a compositekey.
*/
private Test2 test2;

/**
* Constructor
*/
public ExampleKey(Test test, Test2 test2) {
   this.test = test;
   this.test2 = test2;
}

/**
* @hibernate.many-to-one
*       column = "ID_TEST"
*       fetch="join"
*/
public Test getTest() {
   return test;
}

/**
* @hibernate.many-to-one
*    class="br.com.netservicos.core.bean.sn.SnContratoBean"
*   cascade="none"
*   fetch="join"
* @hibernate.column
*   name = "NUM_CONTRATO"
* @hibernate.column
*   name = "CID_CONTRATO"
*/
public Test2 getTest2() {
   return contrato;
}


Thanks in advance

Rafael Mauricio Nami


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.