ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gregg D Bolinger <gthou...@gmail.com>
Subject discriminator and submap
Date Wed, 18 May 2005 06:27:18 GMT
Do these new features in the new 2.1 release help improve my mapping file as 
shown below? If so, can someone tell me how? where I have specified the 
select=".." in the resultMap "issue-result", I am using the namespace and a 
select id to query for that object. I am looking for a quicker/better/more 
concise way of handling this.

Thanks.

<sqlMap namespace="issue">

<resultMap id="issue-result" class="com.intrust.anykey.model.Issue">
<result property="issueId" column="issue_id"/>
<result property="issueNumber" column="issue_number"/>
<result property="dateRaised" column="date_raised"/>
<result property="dateAccepted" column="date_accepted"/>
<result property="dateResolved" column="date_resolved"/>
<result property="dateModified" column="date_modified"/>
<result property="dateExpResolve" column="date_exp_resolve"/>
<result property="inputBy" column="input_by" select="user.getUserById"/>
<result property="lastUpdatedBy" column="last_updated_by" select="
user.getUserById"/>
<result property="employee" column="employee_id" select="
employee.getEmployeeById"/>
<result property="workstationName" column="workstation_name"/>
<result property="summary" column="summary"/>
<result property="additionalInformation" column="additional_info"/>
</resultMap>

<insert id="insertIssue" parameterClass="com.intrust.anykey.model.Issue">
insert into t_issue
(issue_number, date_raised, date_modified, date_accepted, date_exp_resolve, 
date_resolved, input_by,
last_updated_by, employee_id, workstation_name, workstation_id, hardware_id, 
monitor_id, printer_id, problem_id,
system_id, type_id, action_id, level_id, status_id, summary, 
additional_info, accepted_by_user_id, reopened_by_user_id,
resolved_by_user_id)
VALUES
(#issueNumber#, #dateRaised#, #dateModified#, #dateAccepted#, 
#dateExpResolve#, #dateResolved#,
#inputBy.userId#, #lastUpdatedBy.userId#, #employee.employeeId#, 
#workstationName#, #workstation.id#, #hardware.id#,
#monitor.id#, #printer.id#, #problem.id#, #system.id#, #issueType.id#, 
#issueAction.id#, #issueLevel.id#, #issueStatus.id#,
#summary#, #additionalInformation#, #acceptedByUserId.userId#, 
#reopenedByUserId.userId#, #resolvedByUserId.userId#)
</insert>

<select id="getAllIssuesByEmployeeId" resultMap="issue-result" 
parameterClass="int" >
select * from t_issue where employee_id = #value#
</select>

<select id="getAllIssues" resultMap="issue-result">
select * from t_issue
</select>

<select id="findByIssueNumber" resultMap="issue-result" 
parameterClass="string">
select * from t_issue where issue_number = #value#
</select>

<select id="getIssueByUserId" resultMap="issue-result" parameterClass="int">
select * from t_issue, t_user where creating_user_id = #value#;
</select>


</sqlMap>

Mime
View raw message