.................................
String hql="select task,insL.InsName,insR.InsName,tra"
+" from Institution as insL,Transition as tra,Institution as insR,Task as task"
+" where task.id=tra.taskId"
+" and insL.InsId=tra.foreNode"
+" and insR.InsId=tra.aftNode"
+(condition==null?(""):condition);
List list=null;
try{
Query query=session.createQuery(hql);
list=query.list();tx.commit();
}
catch(Exception e){
tx.rollback();
e.printStackTrace();
list=null;
}
finally{
session.close();
}
if(list!=null){
for(int i=0;i<list.size();i++){
TransitionDTO transitionDTO=new TransitionDTO();
Object[] obs=(Object[])list.get(i);
Task tmp_task=(Task)obs[0];
transitionDTO.taskId=tmp_task.getId();
transitionDTO.foreInsName=(String)obs[1];
transitionDTO.aftInsName=(String)obs[2];
Transition tmp_trs=(Transition)obs[3];
transitionDTO.transitionId=tmp_trs.getId();
.....................
注意HQL语句中from后面为类名,"."号后面为属性名,必须和hbm.xml中的相一致,而不是和类名中的属性名相同(尽管很多时候他们是相同的,但HQL语句中的必须和hbm中相一致)
the above code works,while the hbm.xml files don't contain the <many-to-one>properties
分享到:
相关推荐
Application Note(32-bit Cortex-M0 MCU NuMicro Family):An Example of CCID( Circuit Card Interface Devices )
This is an example of how to return all of the files on a users system. This can be easily edited to be close to the normal Windows’ Find File or Folder Dialog.
This is an excellent example of how to highlight HTML code in a rich textbox. I encourage everyone to check it out.
THis is an example source code for the queue implemented by systemc.
An application which is an example of graphics and can be used as screen saver.Number of balls rotating and stars comming out when they collide.
An Example of Using the ’AddressOf’ Operater in VB5 to Limit the Size that the User is Permitted to Resize your Form.
This is an example of how to use the Common Dialog. This demonstrates most of the event procedures of the CM Dialog control.
An example of how to create a coolbar such as the one in Internet Explorer without using a 3rd party control.
本示例文件“An example of rem and mod_matlab_MOD_”很可能是为了演示这两个函数的具体应用和区别。 首先,`rem`函数(remainder)返回两个数相除后的余数。它的用法是`rem(a,b)`,其中`a`是被除数,`b`是除数。`...
An example of the classic game pong...it uses bitblt for displaying and can be very fun. The only known problem is that the gameplay is based on the cpu speed
"Very nice example of creating an MP3 player. Tons of options and effects.." 这个描述揭示了一个高质量的MP3播放器示例,它提供了丰富的功能和效果,这通常意味着该播放器不仅能够基本的播放音频文件,还可能...
Introduction to Variant Configuration with an example model
在这个“example of ucos and ucgui”项目中,包含了两个示例,分别是“example one of ucos and ucgui.rar”和“example two of ucos and ucgui.rar”。这些示例旨在帮助初学者理解如何在STM32平台上集成UCOS-II...
An example of an Android application that makes use of code and resources provided in an Android library project. Specifically, this application uses code and resources provided in the TicTacToeLib ...
An example of psychologist management of teacher reinforcement procedures in the elementary classroom AN EXAMPLE OF PSYCHOLOGIST MANAGEMENT OF TEACHER REINFORCEMENT PROCEDURES I N THE JAMES c. ...
开源项目-itwars-Docker-multi-stage-build#an-example-of-docker-multi-stage-building-with-golang.zip,An example of Docker multi-stage building with Golang