You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-cs@ibatis.apache.org by Mark Witt <ma...@yahoo.com> on 2005/11/29 19:01:23 UTC

Question re: TypeAlias Exception

 I'm trying to review the examples and create basic mappings within VS 2005.
    
    As I'm new  to .NET , I'm not sure this is a .NET related issue or iBatis configuration quesiton.
    
    I seem to have all the correct mapping files and references enabled, but I'm getting the following error: 
    
    IBatisNet.Common.Exceptions.ConfigurationException : Could not  configure TypeAlias. TypeAlias named "Person" not found, failed. Cause:  Enable to resolve type alias named :MHRS.Model.Person, MHRS.Model
    
    Here's the SqlMap.config:
    <?xml version="1.0" encoding="UTF-8" ?>
    <sqlMapConfig
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >
         <properties resource="properties.config"/>
         <settings>
            <setting useStatementNamespaces="false"/>
            <se   tting   cacheModelsEnabled="true"/>
        </settings>
    
        <providers resource="Providers.config"/>
    
        <database>    
            <provider name="${provider}"/>
            <dataSource name="iBatisTutorial"  connectionString="${connectionString}"/>
        </database>
    
        <sqlMaps>
            <sqlMap resource="Resources/Person.xml" />
        </sqlMaps>
    
    </sqlMapConfig>
    
    Here's the Person.xml:
    <?xml version="1.0" encoding="utf-8" ?>
    <sqlMap 
        namespace="Person" 
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    
        <!-- XML "behind" document for the People servic   e class.   -->
    
        <alias>
            <typeAlias alias="Person" type="MHRS.Model.Person, MHRS.Model" />
        </alias>
    
        <resultMaps>
            <resultMap id="SelectResult" class="Person">
                <result property="Id" column="PER_ID" />
                <result property="FirstName" column="PER_FIRST_NAME" />
                <result property="LastName" column="PER_LAST_NAME" />
                <result property="BirthDate" column="PER_BIRTH_DATE" />
                <result property="WeightInKilograms" column="PER_WEIGHT_KG" />
                  <result property="HeightInMeters" column="PER_HEIGHT_M" />
            </resultMap>
        </resultMaps>
    
        <statements>
    
            <select id="Select" parameterClass="int" resultMap="SelectResult">
                select
                PER_ID,
                PER_FIRST_NAME,
                PER_LAST_NAME,
                PER_BIRTH_DATE,
                PER_WEIGHT_KG,
                PER_HEIGHT_M
                from PERSON
                  <dynamic prepend="WHERE">
                    <isParameterPresent>
                        PER_ID = #value#
                    </isParameterPresent>
                </dynamic>
            </select>
    
            <insert id="Insert" parameterClass="Person" resultClass="int">
                insert into PERSON
                (PER_ID, PER_FIRST_NAME, PER_LAST_NAME,
                PER_BIRTH_DATE, PER_WEIGHT_KG, PER_HEIGHT_M)
      &nb   sp;           values
                (#Id#, #FirstName#, #LastName#,
                #BirthDate#, #WeightInKilograms#, #HeightInMeters#)
            </insert>
    
            <update id="Update" parameterClass="Person" resultClass="int">
                update PERSON set
                PER_FIRST_NAME = #FirstName#,
                PER_LAST_NAME = #LastName#,
                PER_BIRTH_DATE = #BirthDate#,
                PER_WEIGHT_KG = #WeightInKilograms#,
                PER_HEIGHT_M = #HeightInMeters#
                  where PER_ID = #Id#
            </update>
    
            <delete id="Delete" parameterClass="int" resultClass="int">
                delete from PERSON
                where PER_ID = #value#
            </delete>
    
        </statements>
    
    </sqlMap>
    
    Any insight into why a typeAlias is not found?
    
    Thanks in advance.
    
    Mark

		
---------------------------------
 Yahoo! Music Unlimited - Access over 1 million songs. Try it free.