-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Hibernate Criteria
PostPosted: Thu Dec 02, 2010 4:51 am 
Newbie

Joined: Thu Dec 02, 2010 4:43 am
Posts: 1
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


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.