Hi,
I would like to select all rows from tables JBPM4_HIST_ACTINST and JBPM4_TASK where JBPM4_HIST_ACTINST.HTASK_ =JBPM4_TASK.DBID_..
i have used criteria and detached criteria for this...but i dunno how to select all the rows..so that i could return it as a List of both the entities rather than a List of specific table entity..
My code is
Criteria criteriaObj=session.createCriteria(HistoryTaskImpl.class);
criteriaObj.add(Restrictions.eq("assignee", userId));
criteriaObj.add(Restrictions.eq("state", status));
criteriaObj.add(Restrictions.eq("serviceName", serviceName));
criteriaObj.add(Restrictions.between("createTime", dateFrom, dateTo));
DetachedCriteria ownerCriteria = DetachedCriteria.forClass(HistoryActivityInstanceImpl.class); ownerCriteria.setProjection(Property.forName("historyTask"));
ownerCriteria.add(Restrictions.eq("transitionType", transitionType));
criteriaObj.add(Property.forName("dbid").in(ownerCriteria));
List <Object> obj=(List<Object> )criteriaObj.list();
This would return an object which contains only HistoryTaskImpl columns..but i want HistoryActivityInstanceImpl columns also..
My hibernate.hbm.xml file is:-
<class name="HistoryTaskImpl" table="JBPM4_TASK"> <id name="dbid" column="DBID_"> <generator class="assigned" /> </id>
</class>
<class name="HistoryActivityInstanceImpl" table="JBPM4_HIST_ACTINST" discriminator-value="act"> <id name="dbid" column=".DBID_"> <generator class="assigned" /> </id>
<subclass name="HistoryTaskInstanceImpl" discriminator-value="human"> <many-to-one name="historyTask" class="HistoryTaskImpl" column="HTASK_" cascade="all" foreign-key="FK_HTI_HTASK" index="IDX_HTI_HTASK" /> </subclass>
</class>
I want my query to be Select task,act from HistoryTaskImpl task,HistoryActivityInstanceImpl act where task.dbid=act.historyTask and task.assignee=:userid and task.state=:status and act.transitionType=:transitionType
Plz do help me in this........
Thanking you
Parvathy
|