java - Hibernate Criteria select using embedded object (tuple) -
in case have sql query looks like:
select * event_instance (object_id, object_type) in (<list of tuples retrieved subquery>);
i want map on hibernate entities , have problem query. mapping looks that:
@entity @table(name="event_instance") public class auditevent { <other_fields> @column( name = "object_type", nullable = false) private string objecttype; @column( name ="object_id" , nullable = false) private integer objectid; }
and second entity:
@entity @table(schema = "els" ,name = "acg_objects") public class acgobject implements serializable{ @id @column(name = "acg_id") private string acgid; @id @column(name="object_type") private string objecttype; @id @column(name="object_id") private integer objectid; <other fields> }
i run query getting acgobjects , dao i'm getting list thing want query touple using criteria like:
crit.add(restrictions.in("objecttype,objectid",<list of tuples>);
is possible? trying use @embedded object don't know how construct query it. please help
you can not in standard sql nor using criteria; have split in 2 distinct restrictions or using session.sqlquery()
if want use specific rdbms (look @ sql where.. in clause multiple columns explanation)
Comments
Post a Comment