You could use dynamic SQL to do that, just make the password '' in the
cases you don't want it.
<select...>
select ...
<isEqual property="showPassword" compareValue="true">password</isEqual>
<isEqual property="showPassword" compareValue="false">'' as password</isEqual>
...
</select>
Larry
On 3/15/07, Collin Peters <[EMAIL PROTECTED]> wrote:
Hi everyone,
I'm just wondering if it is possible to have an optional property in a
resultMap? For example, I have a UserVO class which I use to load
users into. It has fields such as user_id, username, firstname,
lastname, password, etc... I also want to use this class as a
'sub'-resultMap from another call. For example, I have a call called
loadDailySchedule, in this call I grab all events in a schedule, along
with all the participants, and group by the event_id. So the sqlmap
is:
<resultMap id="eventResult" class="EventVO" groupBy="eventID">
<result property="eventID" column="event_id" />
<result property="summary" column="summary" />
<snip...>
<result property="participants" resultMap="common.userResult" />
</resultMap>
The problem is that I don't want to have to include fields like the
users password in this query as it is not needed. If I want to use
the common.userResult resultMap (which uses the UserVO class) though,
I need to include those fields otherwise I get the error: "The column
name password was not found in this ResultSet"
Regards,
Collin