ibatis查询时,返回类型中有其他对象,映射xml文件中怎么写?
代码养殖员 2011-12-19 11:47:39 有一张user表,有userID typeName 字段 ,其中typeName 是 type表中的字段
我建实体类时先创建了Type类然后,User类中包含了Type类的对象。
在user.xml文件中写查询全部user表信息时
<select id="getAllUser" resultClass="User">
select * from user
</select>
会报错
--- The error occurred in User.xml.
--- The error occurred while applying a result map.
--- Check the getAllUser-AutoResultMap.
--- Check the result mapping for the 'type' property.
我想是因为我设置的返回类型是User。但是User对象中的type属性不能够接收,ibatis查询User表时查到的typeName
我尝试着
<select id="getAllUser" resultClass="User">
select userID,type.typeName from user
</select>
会报错说:
--- Cause: java.sql.SQLException: ORA-00904: "type"."typeName":标识符无效
有什么解决方法呀??