|
Hi
I have the following resultMap <resultMap id="ProductList" type="Product"> <result property="id" column="product_type_id"/> <result property="facilityIdParent" column="facility_id"/> <result property="counterpartyParentId" column="parent_bp_id"/> <result property="name" column="product_type"/> <result property="counterpartyId" column="bp_id"/> <association property="externalBranches" column="{cid=bp_id,pid=product_type_id,fid=facility_id}" select="findExternalByPid"/> <association property="internalBranches" column="{cid=bp_id,pid=product_type_id,fid=facility_id}" select="findInternalByPid"/> </resultMap> and the two select statements below <select id="findExternalByPid" resultType="Branch"> <include refid="findBranchesForParams"/> and pf.is_internal=2 order by plc </select> <select id="findInternalByPid" resultType="Branch"> <include refid="findBranchesForParams"/> and pf.is_internal=1 order by plc </select> which refer to the following: <sql id="findBranchesForParams"> select distinct cor.bp_id, cor.parent_bp_id, cor.legal_name name, pos.plc city, cnt.cntry_name domicile from ..... </sql> The findBranchesForParams sql refers to these #{cid}, #{pid} and #{fid} (as specified above). class Product { private Long id; private String name; private BigDecimal facilityIdParent; private List<Branch> externalBranches; private List<Branch> internalBranches; private BigDecimal counterpartyId; private BigDecimal counterpartyParentId; } class Branch { private String name; private String city; private String domicile; I've included all the relevant bits. Can you tell me what the issue is? I get the following exception: org.mybatis.spring.MyBatisSystemException : nested exception is org.apache.ibatis.reflection.ReflectionException: There is no setter for property named 'cid' in 'class java.lang.Object' This used to work fine with iBatis. The only change I made was that I changed the last two of the resultMap into association and added the curly brackets. Is there something else I need to change? I can't really solve it with the exception message I get as I'm not sure what the problem is. Many Thanks Andreas |
|
Hi Andreas,
I believe it is fixed in the forthcoming version 3.1.0. http://code.google.com/p/mybatis/issues/detail?id=118 It would be great if you could verify the fix with the snapshot. http://code.google.com/p/mybatis/downloads/list?can=3&q=snapshot http://code.google.com/p/mybatis/wiki/DocMavenTutorial If using snapshot is not your option, adding parameterType="map" to both <select /> may solve the problem. Regards, Iwao 2012/2/22 Andreas Markitanis <[hidden email]>: > Hi > > I have the following resultMap > > <resultMap id="ProductList" type="Product"> > <result property="id" column="product_type_id"/> > <result property="facilityIdParent" column="facility_id"/> > <result property="counterpartyParentId" column="parent_bp_id"/> > <result property="name" column="product_type"/> > <result property="counterpartyId" column="bp_id"/> > <association property="externalBranches" column="{cid=bp_id,pid=product_type_id,fid=facility_id}" > select="findExternalByPid"/> > <association property="internalBranches" column="{cid=bp_id,pid=product_type_id,fid=facility_id}" > select="findInternalByPid"/> > </resultMap> > > and the two select statements below > > <select id="findExternalByPid" resultType="Branch"> > <include refid="findBranchesForParams"/> > and pf.is_internal=2 > order by plc > </select> > > > <select id="findInternalByPid" resultType="Branch"> > <include refid="findBranchesForParams"/> > and pf.is_internal=1 > order by plc > </select> > > which refer to the following: > > <sql id="findBranchesForParams"> > select distinct > cor.bp_id, > cor.parent_bp_id, > cor.legal_name name, > pos.plc city, > cnt.cntry_name domicile > from ..... > </sql> > > The findBranchesForParams sql refers to these #{cid}, #{pid} and #{fid} (as specified above). > > class Product { > > private Long id; > private String name; > private BigDecimal facilityIdParent; > private List<Branch> externalBranches; > private List<Branch> internalBranches; > private BigDecimal counterpartyId; > private BigDecimal counterpartyParentId; > > } > > class Branch { > > private String name; > private String city; > private String domicile; > > > I've included all the relevant bits. > > Can you tell me what the issue is? > > I get the following exception: > > org.mybatis.spring.MyBatisSystemException : nested exception is org.apache.ibatis.reflection.ReflectionException: There is no setter for property named 'cid' in 'class java.lang.Object' > > This used to work fine with iBatis. The only change I made was that I changed the last two of the resultMap into association and added the curly brackets. > > Is there something else I need to change? > > I can't really solve it with the exception message I get as I'm not sure what the problem is. > > Many Thanks > Andreas > > |
| Powered by Nabble | Edit this page |
