Hi,
I am new to hibernate and need help setup the following
select a.* from a, b, c where a.1stId = b.1stId and b.2ndId = c.2ndId and c.somecolumn = 'BLA';
i tried setting up below
@Entity @Table(name="a") @SecondaryTable(name="b") public class a { @Column(table="b") private long Id2;
@Id @Column(name="1stId") private long Id1;
private c ac; }
@Entity public class c { @Id @Column(name="2ndId") private long 2ndId @Column(name="somecolumn") private String someColumn; }
primary key for table b is 1stId
Criteria crit = sess.createCriteria(a.class); crit.createCriteria("ac").add(Restrictions.like("somecolumn", strVal)));
I get below sql instead
select a.* from a, b, c where a.1stId = b.1stId and b.1stId = c.2ndId and c.somecolumn = 'BLA';
Please help, Thanks
|