Thanks a lot Clinton, I tried to replace <result> with <id> but it didn't do the trick. Here's a JIRA ticket with test case attached https://issues.apache.org/jira/browse/IBATIS-646.
Olaf Clinton Begin wrote: > > Can you create a failing unit test and attach it to a JIRA ticket? > > For giggles, make all of the "bidResult" properties <id> instead of > <property>... > > Clinton > > On Sat, Sep 5, 2009 at 4:43 PM, olafos <olaf...@wp.pl> wrote: > >> >> Hi I was using IBatis 2 and decided to try out IBatis 3 beta 3. I have a >> problem with association mapping when all columns of the associated >> result >> map are NULL - I'm pretty sure that in IBatis 2 such association would >> have >> a null value, in IBatis 3 it produces and object with null fields. >> >> This is my sql schema: >> >> CREATE TABLE DB_AUCTION_STATE ( >> `AS_AUCTION_FKEY` BIGINT NOT NULL, >> `AS_SEQ` BIGINT NOT NULL, >> `AS_PRICE` BIGINT NOT NULL, >> `AS_VALUE` BIGINT NOT NULL, >> `AS_INCOME` BIGINT NOT NULL, >> `AS_BID_SEQ` BIGINT, >> `AS_BID_COST` BIGINT, >> `AS_BID_VALUE` BIGINT, >> `AS_FINISHED` BOOLEAN NOT NULL, >> CONSTRAINT `IDX_DB_AUCTION_STATE_PKEY` PRIMARY KEY >> (`AS_AUCTION_FKEY`, >> `AS_SEQ`) >> ); >> >> And here's a fragment of my mapper config: >> >> <resultMap type="Bid" id="bidResult"> >> <result property="seq" column="AS_BID_SEQ"/> >> <result property="cost" column="AS_BID_COST"/> >> <result property="value" column="AS_BID_VALUE"/> >> </resultMap> >> >> <resultMap type="AuctionStateSnapshot" id="auctionStateSnapshotResult"> >> <result property="seq" column="AS_SEQ" javaType="long" >> jdbcType="BIGINT"/> >> <result property="price" column="AS_PRICE" javaType="long" >> jdbcType="BIGINT"/> >> <result property="value" column="AS_VALUE" javaType="long" >> jdbcType="BIGINT"/> >> <result property="income" column="AS_INCOME" javaType="long" >> jdbcType="BIGINT"/> >> <result property="finished" column="AS_FINISHED" >> javaType="boolean" >> jdbcType="BOOLEAN"/> >> <association property="bid" resultMap="bidResult"/> >> </resultMap> >> >> <select id="selectListCurrentAuctionState" parameterType="long" >> resultMap="auctionStateSnapshotResult"> >> select * from DB_AUCTION_STATE where AS_AUCTION_FKEY = #{key} >> order >> by >> AS_SEQ desc limit 1; >> </select> >> >> When `AS_BID_SEQ`, `AS_BID_COST` and `AS_BID_VALUE` are null in the >> result >> set i still get a not-null bid field in AuctionStateSnapshot with all >> fields >> set to null. Is this a desired behaviour? Is there some workaround for >> this? >> >> Please help, >> Olaf Tomczak >> >> -- >> View this message in context: >> http://www.nabble.com/association-in-IBatis3-tp25312975p25312975.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 >> >> > > -- View this message in context: http://www.nabble.com/association-in-IBatis3-tp25312975p25317007.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