Need to return SINGLE column Date value in mybatis query

I'm new to IBatis/Mybatis and ORM and Java in general. I have a java mapper interface and the respective mapper xml. The domain object type that the query method should return is called SourceStatus. This object contains several attributes and getters/setters etc. I really only want to populate the date field of the SourceStatus domain object. Am I wiring my mybatis mapper file properly?

Java Mapper file containing method definition:

public interface SupportSourceStatusMapper extends TPBMapper {
    SourceStatus getSupportStatus();

MyBatis XML mapper file:

<mapper namespace="com.dealersInc.dao.mapper.SupportSourceStatusMapper">

<select id="getSupportStatus" resultType="Date">
    SELECT MAX(s_valid_frm_dat)
        FROM deals.supports_contracts


The SourceStatus domain object:

public class SourceStatus
    private long   contextKey;
    private String serviceName;
    private String contextName;
    private String contextRunType;
    private String contextLabel;
    private String contextStatus;
    private Date   cobDate;

getters/setters ()....

Thank you in advance for any help you can provide.


You could specify alias for SourceStatus, but for simplicity sake it's sufficient to specify fully qualified class name. Note that column name maps to SourceStatus property name:

<select id="getSupportStatus" resultType="com.dealersInc.domain.SourceStatus">
    SELECT MAX(s_valid_frm_dat) AS cobDate
        FROM deals.supports_contracts

You can map result like this:

<resultMap id="StatusResult" type="com.dealersInc.domain.SourceStatus">

        <result property="cobDate" column="max_date" />

        <result property="optionalyOtherClassParams" column="other_column_name" />


<select id="getSupportStatus" resultMap="StatusResult">
    SELECT MAX(s_valid_frm_dat) AS max_date
        FROM deals.supports_contracts

See for more

Need Your Help

Encrypting string in javascript and decryption in java

java javascript cryptography public-key-encryption

I would like to know if someone know any library to do encryption in javascript and decryption in java. I have already tried many API, But getting not not getting same values in java. I want public-

WP7: Styling ListBox items

c# windows-phone-7 xaml

I'm new to Windows Phone 7 development. I need to create a page very similar to the settings app page. Something like this (but without the menu at the top and the subtext for each item):