Announcement Announcement Module
Collapse
No announcement yet.
Ibatis issue:Can't Complex Property Support Set Immediately! Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Ibatis issue:Can't Complex Property Support Set Immediately!

    :oops: It's a Ibatis problem. I have posted the same one in the forum of ibatis.org. But I do want to post here, because I think here is more popular.

    I am a newbie to ibatis.I came against a problem when studying ibatis!

    Can't Complex Property Support Set Immediately!
    I have seen the following word in Ibatis-SqlMap 2.0
    P 26

    <quote>
    To load a List of objects,
    there is no change to the statement (see example above). The only difference required to cause the SQL
    Map framework to load the property as a List is that the property on the business object must be of type
    java.util.List or java.util.Collection.
    </quote>

    Is it mean that I must use in this type
    Class A
    {
    List bs;
    // or Collection bs;
    }
    instead of this type
    {
    Set bs
    }

    I have done a example about this.In the same program, if I change the Complex Property form List to Set(had done the nesessary job), I throw some Exception:

    Translating SQLException with SQLState 'null' and errorCode '0' and message [
    --- The error occurred in ibatis/Entity.xml.
    --- The error occurred while applying a result map.
    --- Check the entityResult.
    --- The error happened while setting a property on the result object.
    --- Cause: net.sf.cglib.beans.BulkBeanException]; SQL was [(mapped statement)] for task [SqlMapClientTemplate]
    org.springframework.jdbc.UncategorizedSQLException : (SqlMapClientTemplate): encountered SQLException [
    --- The error occurred in ibatis/Entity.xml.
    --- The error occurred while applying a result map.
    --- Check the entityResult.
    --- The error happened while setting a property on the result object.
    --- Cause: net.sf.cglib.beans.BulkBeanException]; nested exception is com.ibatis.common.jdbc.exception.NestedSQLExceptio n:
    --- The error occurred in ibatis/Entity.xml.
    --- The error occurred while applying a result map.
    --- Check the entityResult.
    --- The error happened while setting a property on the result object.
    --- Cause: net.sf.cglib.beans.BulkBeanException
    com.ibatis.common.jdbc.exception.NestedSQLExceptio n:
    --- The error occurred in ibatis/Entity.xml.
    --- The error occurred while applying a result map.
    --- Check the entityResult.
    --- The error happened while setting a property on the result object.
    --- Cause: net.sf.cglib.beans.BulkBeanException
    Caused by: net.sf.cglib.beans.BulkBeanException

    Here is my code snippet:

    <resultMap id="entityResult" class="entity">
    <result property="id" column = "ID"/>
    <result property="name" column="NAME"/>
    <result property="child" column = "ID" select="getEntityChildrenByParentEntityId"/>
    </resultMap>

    <select id="getEntityChildrenByParentEntityId" resultMap="entityChildResult" parameterClass="string">
    select ID, NAME from ENTITYCHILD WHERE PARENT_ENTITY_ID = #value#
    </select>

    //I use spring stuff

    public List find(Object object)
    {
    mapSql = ClassUtils.getShortName(object.getClass()) + "." + "find";

    List list = getSqlMapClientTemplate().queryForList(mapSql, object);

    return list;
    }

    I did could work well with List,but how can't I work with Set!

    Any suggestion and hints will be appreciated!

    Thanx in advance!

    Regards.
    Yoshiyan

  • #2
    I have got the answer from Clinton in the forum of iBATIS.org. He told me that iBATIS didn't support the Set type complex property now, but he would add to wish list.

    Here is the link:

    http://sourceforge.net/forum/forum.p...orum_id=206693

    CHEERS
    Yoshiyan

    Comment


    • #3
      Originally posted by yoshi
      I have got the answer from Clinton in the forum of iBATIS.org. He told me that iBATIS didn't support the Set type complex property now, but he would add to wish list.

      Here is the link:

      http://sourceforge.net/forum/forum.p...orum_id=206693

      CHEERS
      Yoshiyan
      I think it was added in the just released v2.07

      Comment

      Working...
      X