Return-Path: Delivered-To: apmail-ibatis-user-java-archive@www.apache.org Received: (qmail 52618 invoked from network); 6 Sep 2009 07:43:49 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 6 Sep 2009 07:43:49 -0000 Received: (qmail 9743 invoked by uid 500); 6 Sep 2009 07:43:48 -0000 Delivered-To: apmail-ibatis-user-java-archive@ibatis.apache.org Received: (qmail 9689 invoked by uid 500); 6 Sep 2009 07:43:48 -0000 Mailing-List: contact user-java-help@ibatis.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user-java@ibatis.apache.org Delivered-To: mailing list user-java@ibatis.apache.org Received: (qmail 9681 invoked by uid 99); 6 Sep 2009 07:43:48 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 06 Sep 2009 07:43:48 +0000 X-ASF-Spam-Status: No, hits=2.2 required=10.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of clinton.begin@gmail.com designates 209.85.212.191 as permitted sender) Received: from [209.85.212.191] (HELO mail-vw0-f191.google.com) (209.85.212.191) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 06 Sep 2009 07:43:37 +0000 Received: by vws29 with SMTP id 29so1331287vws.4 for ; Sun, 06 Sep 2009 00:43:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type; bh=rx67NJKjO3cZ62MINiIsEcfP1xZmZ5KeKw0kvokDbx4=; b=sogSPPA1z68ChJFNwKVyHukekFoy8UX+nIcYbXA0EwsUCyOzBC6lhXFaEoKR5tuNoC SV2HBiz60ZR21VWpbCLtx6le/7So6KuuyRVNQGiVgECUzmq6AAqJemvC1uRD9bI7rLhJ qTFOUhtjPnmq5rOeGmIc8qTtT/N9edFsGNlbU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=gBgdC1j+dO2ZV9eavwO6e2kHZq7YKgk7m2WKnXlooh0TJHmrBBSXsmVcMDIlYkb3O+ 1zJNkQUqYHyxJueeQAtsdtV69fKotf38hAgGLVVh510ueL/2ey//yhxZqwG82t/Hb+VS oMBKlt/bjOS2XICuB/nsrZXSyM70jTyPLYguc= MIME-Version: 1.0 Received: by 10.220.120.6 with SMTP id b6mr5776281vcr.3.1252222996531; Sun, 06 Sep 2009 00:43:16 -0700 (PDT) In-Reply-To: <25312975.post@talk.nabble.com> References: <25312975.post@talk.nabble.com> Date: Sun, 6 Sep 2009 01:43:16 -0600 Message-ID: <16178eb10909060043v729e5e85o5e442cc7a4f6ade7@mail.gmail.com> Subject: Re: association in IBatis3 From: Clinton Begin To: user-java@ibatis.apache.org Content-Type: multipart/alternative; boundary=000e0cd6b398e34cba0472e3e2a2 X-Virus-Checked: Checked by ClamAV on apache.org --000e0cd6b398e34cba0472e3e2a2 Content-Type: text/plain; charset=ISO-8859-1 Can you create a failing unit test and attach it to a JIRA ticket? For giggles, make all of the "bidResult" properties instead of ... Clinton On Sat, Sep 5, 2009 at 4:43 PM, olafos 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: > > > > > > > > > jdbcType="BIGINT"/> > jdbcType="BIGINT"/> > jdbcType="BIGINT"/> > jdbcType="BIGINT"/> > jdbcType="BOOLEAN"/> > > > > > > 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-unsubscribe@ibatis.apache.org > For additional commands, e-mail: user-java-help@ibatis.apache.org > > --000e0cd6b398e34cba0472e3e2a2 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Can you create a failing unit test and attach it to a JIRA ticket?

= For giggles, make all of the "bidResult" properties <id> in= stead of <property>...

Clinton

On Sat, Sep 5, 2009 at 4:43 PM, olafos <olafoos@wp.pl&= gt; 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<= br> 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 (
=A0 =A0 =A0 =A0`AS_AUCTION_FKEY` BIGINT NOT NULL,
=A0 =A0 =A0 =A0`AS_SEQ` BIGINT NOT NULL,
=A0 =A0 =A0 =A0`AS_PRICE` BIGINT NOT NULL,
=A0 =A0 =A0 =A0`AS_VALUE` BIGINT NOT NULL,
=A0 =A0 =A0 =A0`AS_INCOME` BIGINT NOT NULL,
=A0 =A0 =A0 =A0`AS_BID_SEQ` BIGINT,
=A0 =A0 =A0 =A0`AS_BID_COST` BIGINT,
=A0 =A0 =A0 =A0`AS_BID_VALUE` BIGINT,
=A0 =A0 =A0 =A0`AS_FINISHED` BOOLEAN NOT NULL,
=A0 =A0 =A0 =A0CONSTRAINT `IDX_DB_AUCTION_STATE_PKEY` PRIMARY KEY (`AS_AUC= TION_FKEY`,
`AS_SEQ`)
);

And here's a fragment of my mapper config:

<resultMap type=3D"Bid" id=3D"bidResult">
=A0 =A0 =A0 =A0<result property=3D"seq" column=3D"AS_BID= _SEQ"/>
=A0 =A0 =A0 =A0<result property=3D"cost" column=3D"AS_BI= D_COST"/>
=A0 =A0 =A0 =A0<result property=3D"value" column=3D"AS_B= ID_VALUE"/>
</resultMap>

<resultMap type=3D"AuctionStateSnapshot" id=3D"auctionSta= teSnapshotResult">
=A0 =A0 =A0 =A0<result property=3D"seq" column=3D"AS_SEQ= " javaType=3D"long" jdbcType=3D"BIGINT"/>
=A0 =A0 =A0 =A0<result property=3D"price" column=3D"AS_P= RICE" javaType=3D"long"
jdbcType=3D"BIGINT"/>
=A0 =A0 =A0 =A0<result property=3D"value" column=3D"AS_V= ALUE" javaType=3D"long"
jdbcType=3D"BIGINT"/>
=A0 =A0 =A0 =A0<result property=3D"income" column=3D"AS_= INCOME" javaType=3D"long"
jdbcType=3D"BIGINT"/>
=A0 =A0 =A0 =A0<result property=3D"finished" column=3D"A= S_FINISHED" javaType=3D"boolean"
jdbcType=3D"BOOLEAN"/>
=A0 =A0 =A0 =A0<association property=3D"bid" resultMap=3D&quo= t;bidResult"/>
</resultMap>

<select id=3D"selectListCurrentAuctionState" parameterType=3D&= quot;long"
resultMap=3D"auctionStateSnapshotResult">
=A0 =A0 =A0 =A0select * from DB_AUCTION_STATE where AS_AUCTION_FKEY =3D #{= 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<= br> set i still get a not-null bid field in AuctionStateSnapshot with all field= s
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.co= m/association-in-IBatis3-tp25312975p25312975.html
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
For additional commands, e-mail: user-java-help@ibatis.apache.org


--000e0cd6b398e34cba0472e3e2a2--