-->
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.  [ 2 posts ] 
Author Message
 Post subject: Hibernate Annotation + Composite Id + Many To One
PostPosted: Fri Mar 06, 2009 8:45 am 
Newbie

Joined: Fri Mar 06, 2009 8:41 am
Posts: 1
Hi.

I need to map the following scenario>

TABLEA:
COL1 - INT - PK
COL2 - INT - PK

TABLEB:
TABLEA_COL1 - INT - PK
TABLEA_COL2 - INT - PK
COL3 - INT - PK

I have a TABLEA with a composite primary key.
TABLEB also has a composite primary key with 3 cols: 2 referencing TABLEA and another INT col.

public class TabelaB {
@Id
@ManyToOne
@JoinColumns({
@JoinColumn(name="TABELAA_COLUNA1", referencedColumnName="COLUNA1"),
@JoinColumn(name="TABELAA_COLUNA2", referencedColumnName="COLUNA2")})
private TabelaA tabelaA;

@Id
@Column(name = "COLUNA3", nullable = false)
private Integer coluna3;
}

This way is not working.

How can i do it?

Thanks,

Wellington


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 06, 2009 1:15 pm 
Newbie

Joined: Tue Mar 25, 2008 2:04 pm
Posts: 4
What is the error you are getting? More specifically, have you thrown on the Hibernate trace to see the query that is being generated?


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