Probably you should use resultMap instead of resultClass. <resultMap id="planType" class="data.model.DotPlanType"> <result property="comp_id.terminalid" column="TERMINALID"/> <result property="comp_id.planTypeLid" column="PLAN_TYPE_LID"/> ...
<select id="getPlanTypeByName" resultClass="data.model.DotPlanType" > select TERMINALID, PLAN_TYPE_LID, PLAN_TYPE_SID from dbo.PlanType where PLAN_TYPE_NAME = #PlanTypeName# </select> I've not tryed this approach yet, but I hope it will work. On Thu, 25 Nov 2004 09:06:16 -0500, Laurent Duperval <[EMAIL PROTECTED]> wrote: > Aliaksandr Radzivanovich wrote: > > > > >I think it does. > >If your composite key property is a class, then you can access its > >properties like in the following example: > >class CompositeKey { > > int getKey1() {...}; > > int getKey2() {...}; > > ... > >} > >class Bean { > > CompositeKey getId() {...}; > > ... > >} > >SELECT * FROM Table WHERE Key1 = #id.key1#, key2 = #id.key2#, ... > > > > > > > > Thanks. I tried that but I get this problem: > > org.springframework.jdbc.UncategorizedSQLException: > (SqlMapClientTemplate): encountered SQLException [ > --- The error occurred in data/model/maps/PlanType.map.xml. > --- The error occurred while applying a parameter map. > --- Check the getPlanTypeByName-InlineParameterMap. > --- Check the statement (query failed). > --- Cause: java.sql.SQLException: Line 1: Incorrect syntax near '.'.]; > nested exception is com.ibatis.common.jdbc.exception.NestedSQLException: > . > . > . > > The code looks like this: > > <select id="getPlanTypeByName" resultClass="data.model.DotPlanType" > > select > TERMINALID as comp_id.terminalid, > PLAN_TYPE_LID as comp_id.planTypeLid, > PLAN_TYPE_SID as comp_id.planTypeSid > from dbo.PlanType where > PLAN_TYPE_NAME = #PlanTypeName# > </select> > > comp_id is the name of my key. If I remove the "comp_id." portion, the > syntax error disappears but the code fails. > > L > >