<?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="alfresco.lock">

    <insert id="insert_LockResource" parameterClass="LockResource" >
    
       <selectKey resultClass="long" keyProperty="id">
            select nextVal('alf_lock_resource_seq')
        </selectKey>
        
        insert into alf_lock_resource (id, version, qname_ns_id, qname_localname)
        values (#id#, #version#, #qnameNamespaceId#, lower(#qnameLocalName#))
            
    </insert>

    <insert id="insert_Lock" parameterClass="Lock" >
    
       <selectKey resultClass="long" keyProperty="id">
            select nextVal('alf_lock_seq')
        </selectKey>
        
        insert into alf_lock (id, version, shared_resource_id, excl_resource_id, lock_token, start_time, expiry_time)
        values (#id#, #version#, #sharedResourceId#, #exclusiveResourceId#, lower(#lockToken#), #startTime#, #expiryTime#)
        
    </insert>

</sqlMap>