Thank you, Guy, you have been a big help! This is what I came up with. It works, but not as well as I had hoped.
<resultMap type="User" id="userMap"> <constructor> <idArg column="id" javaType="UserID" typeHandler="UserIDHandler"/> <arg column="gender" javaType="Gender" typeHandler="GenderHandler"/> <arg column="email" javaType="EmailAddress" typeHandler="EmailAddressHandler"/> <arg column="phone" javaType="TelephoneNumber" typeHandler="TelephoneNumberHandler"/> <arg column="birth_date" javaType="LocalDate" typeHandler="LocalDateHandler"/> <arg column="password_hash" javaType="SHA1" typeHandler="SHA1Handler"/> <arg column="avatar_id" javaType="StaticFileID" typeHandler="StaticFileIDHandler"/> <arg column="organization_id" javaType="OrganizationID" typeHandler="OrganizationIDHandler"/> <arg column="version" javaType="int"/> </constructor> <association property="name" javaType="Name"> <constructor> <arg column="first_name" javaType="String"/> <arg column="middle_name" javaType="String"/> <arg column="last_name" javaType="String"/> <arg column="suffix" javaType="String"/> </constructor> </association> </resultMap> I was surprised that I had to specify the javaType for every parameter. Otherwise, iBATIS treated everything as an Object and could not find a corresponding constructor. I then discovered that iBATIS was looking for an Integer argument for the version even though I specified the javaType to be an int. Finally, I had to remove name from the constructor since constructor tags do not support child association tags. As a side note, I try to follow the recommendation by Joshua Bloch in Effective Java to use static factory methods instead of constructors, so I only have private constructors. I used DefaultObjectFactory as a model to create my own ObjectFactory that first looks for a matching static factory method before looking for a constructor. One of the reasons I chose iBATIS was that Hibernate put too many constraints on my domain model. It isn't really a POJO if you say it has to have a public constructor, an empty constructor, and setters for every property. iBATIS is less strict, but still has some hoops to jump through. Wouldn't it be nice to have a persistence layer that transparently accommodated the domain model? What if I wanted to use a separate Factory class to create my User objects? I am willing to help make these changes to iBATIS if I am not missing something that may already be there. Sincerely, Dan Forward -- View this message in context: http://old.nabble.com/Mapping-a-Complex-Object-tp26961927p26997280.html Sent from the iBATIS - User - Java mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org For additional commands, e-mail: user-java-h...@ibatis.apache.org