   
Bumper
Comedian Username: Bumper
Post Number: 1995 Registered: 07-2014 Posted From: 204.80.58.133
Rating: N/A Votes: 0 (Vote!) | | Posted on Wednesday, October 29, 2014 - 03:59 pm: |
     |
First table with EmbeddedId , sepearte class for embeddedID @Entity @Table(schema = "Test1", name = "Example_Roles") public class ExampleRoles implements Identifiable { private static final long serialVersionUID = 1L; @EmbeddedId private ExampleRolesKey key; @Embeddable public class ExampleRolesKey implements Serializable { @Column(name = "user_id", length = 10) private Long userId; @Column(name = "application") private String application; @Column(name = "x_role", length = 10) private String xRole; Second class with embeddedID , Seperate class for embeddedId @Entity @Table(schema = "Test1", name = "Example2_Roles") public class Example2Roles implements Identifiable { private static final long serialVersionUID = 1L; @EmbeddedId private Example2RolesKey key; @Embeddable public class Example2RolesKey implements Serializable { @Column(name = "user_id", length = 10) private String application; @Column(name = "y_roles") private String yRoles; I am trying to excute My query is (List<example2roles>)getSession().createCriteria(Example2Rol es.class) .createAlias("ExampleRoles", "egRls") .add(Restrictions.eq("egRls.key.userId", userId)) .add(Restrictions.eq("egRls.key.application", application)) .add(Restrictions.eq("egRls.key.application", "aexample2RolesKey.application")) .add(Restrictions.eq("egRls.key.xRole", "example2RolesKey.yRoles")) .list() ; please OnetoOne or manytoMany anotation rasi query excute ela chealo teliste konchem help cheandii |