<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE sqlMap PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0//EN"
        "http://ibatis.apache.org/dtd/sql-map-2.dtd">

<sqlMap namespace="subscriber">

    <typeAlias alias="Integer" type="java.lang.Integer"/>

    <typeAlias alias="Subscriber" type="data.domains.Subscriber"/>

    <resultMap id="SubscriberLazyMap" class="Subscriber">
        <result property="subscriberId" column="id" nullValue="0"/>
        <result property="name" column="name"/>
        <result property="surname" column="surname" />
        <result property="phone" column="phone" />
        <result property="address" column="address" />
    </resultMap>

    <select id="selectSubscriberById" parameterClass="long"
            resultMap="subscriber.SubscriberLazyMap">
        SELECT *
            FROM subscriber
            WHERE id = #subscriber_id#
    </select>

    <select id="selectSubscribers" parameterClass="long"
            resultMap="subscriber.SubscriberLazyMap">
        SELECT *
            FROM subscriber
    </select>

</sqlMap>