-->
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-Many annotations. Composite PK Table name concat
PostPosted: Thu Jan 26, 2006 4:03 pm 
Newbie

Joined: Thu Jan 26, 2006 2:23 pm
Posts: 1
Location: Brazil
Hi all, I'm trying to do a Many-toMany relationship between two strong tables and one relational table using Hibernate 3.0.

My environment is the following:

Table1
col1 (PK)
col2 (PK)
col3 (PK)

Table2
col4(PK)

Table1_Table2 (This is the relational table just to link Table1 to Table2)
col1 (FK)
col2 (FK)
col3 (FK)
col4 (FK)

Table1VO.java Mapping:

Code:
@OneToMany ( targetEntity = Table2VO.class,
         cascade = { CascadeType.MERGE }, fetch = FetchType.LAZY )
    @JoinTable(table=@Table(name="Table1_Table2"))
    @JoinColumns ({
        @JoinColumn(name="col1", referencedColumnName = "col1"),
        @JoinColumn(name="col2", referencedColumnName = "col2"),
        @JoinColumn(name="col3", referencedColumnName = "col3"),
        @JoinColumn(name="col4", referencedColumnName = "col4")
    })


When I run my testcase, the select that Hibernate build is the following:

Code:
select table_.TABLE1_col1 as TABLE13_0_,
       table_.table2_col2 as table24_0_
from
     TABLE1_TABLE2 table_
where
      table_.TABLE1_col1=?


What's happen, I don't know why by Hibernate is concating TABLE NAME to the COLUMN NAME, resulting in a Invalid Column Name error.

Could anybody help me?

Best Regards.

Sergio Flor.

_________________
Sergio Flor.


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.