Hello EveryOne,
@Entity
public class Parent {
@EmbeddedId
private Child child;
@Column(name = "TEST")
private long test;
getter setter
}
and chlid class
@Embeddable
public class Child {
@Column(name = "TEST1", length = 50, nullable = false)
private String test1;
@Column(name = "TEST2", length = 50, nullable = false)
private String test2;
getter setter and hasCode and Equal function
}
There are model with Embeddable Composite Key.
String hql = "select v from Parent v WHERE v.child.test1= abc";
List<Parent> list2 = sessionFactory.getCurrentSession()
.createQuery(hql).list();
and this is query.
if i am put where clause on child.test1 then it will return null,null as record.but if i am remove a where clause then it will be map fine with Parent.
Please Help me.