<?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="server">

    <typeAlias alias="Server" type="data.domains.ServerUsernamePass" />
    <typeAlias alias="Map" type="java.util.Map" />

    <resultMap id="ServerMap" class="Server">
        <result property="username" column="username" />
        <result property="password" column="password" />
    </resultMap>

    <select id="getServerUsernamePassword"  resultMap="server.ServerMap">
          SELECT * from server_parameters limit 1 offset 0
    </select>

    <insert id="addServerUsernamePassword" parameterClass="Map">
        insert into server_parameters(username, password) values (#username#,#password#)
    </insert>

    <update id="changeServerUsernamePassword" parameterClass="Map" >
        UPDATE server_parameters
            SET username=#username# ,
                password=#password#
    </update>

</sqlMap>