Hibernate using OneToOne
Posted
by Soft
on Stack Overflow
See other posts from Stack Overflow
or by Soft
Published on 2010-05-31T02:41:21Z
Indexed on
2010/05/31
2:52 UTC
Read the original article
Hit count: 224
hibernate
|hibernate-annotations
I have two tables
tab1 { col1 (PK), col2, col3 }
tab2 { col1, col2(PK), col3 }
I am using Hibernate annotation for joining using "OneToOne"
I have the below Hibernate class for tab1
class tab1 {
@OneToOne
@JoinColumn(name = "col2", referencedColumnName = "col1")
private tab2 t2;
}
i was expecting to run the below sql
select * from tab1 t1, tab2 t2 where t1.col1 = t2.col2
But it is not working as i expected.Please help
© Stack Overflow or respective owner