多表查询:

类别:Java 点击:0 评论:0 推荐:
多表查询:
<class
name="com.Test1"
table="test1">
<id
name="id1"
type="java.lang.Integer"
column="id1"
>
<generator class="assigned" />
</id>
<property name="name1" column="name1" type="java.lang.String" length="20" />
<property name="age1" column="age1" type="java.lang.String" length="20" />
</class>
下面是代码
String sql = "select test1,test2 from Test1 test1,Test2 test2";
List list = session.find(sql);
for(int i=0;i<list.size();i++)
{
Object[] obj = (Object[])list.get(i);
Test1 t1 = (Test1)obj[0];
Test2 t2 = (Test2)obj[1];
}

本文地址:http://com.8s8s.com/it/it15003.htm