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



Reply via email to