You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-java@ibatis.apache.org by Daryl Stultz <da...@6degrees.com> on 2010/02/03 14:00:53 UTC

detect unloaded field

Hello,

I've seen examples of a "selective update" where only non-null fields are
written into the query. I'd like to do the same for unloaded fields. Is
there a way I can detect if a lazy-loaded field has been loaded yet?

Ultimately I'd like to do full dirty field tracking using CGLIB but I'm not
quite ready for that.

-- 
Daryl Stultz
_____________________________________
6 Degrees Software and Consulting, Inc.
http://www.6degrees.com
mailto:daryl@6degrees.com

Re: detect unloaded field

Posted by Daryl Stultz <da...@6degrees.com>.
On Wed, Feb 3, 2010 at 9:16 AM, Clinton Begin <cl...@gmail.com>wrote:

> Sounds like you'd be half way to building Hibernate.  :-)  iBATIS doesn't
> currently provide the facility to check loaded fields.
>
>
Thanks for the information, Clinton. I see the smiley face, so I'm not
offended or anything, but I am wondering what the "iBATIS" way of doing
things is. I often mark records as "modified on / by". If a user opens the
editor view for an object and clicks save without changing anything, I'd
rather not mark the object as "modified". I also don't want to write a value
the user didn't change if some other user/process changed the field while
the first user was staring at the screen. I certainly don't want to bloat
things. I'm coming from OpenJPA which I view as "too sophisticated" for my
needs. Maybe iBATIS isn't sophisticated enough and I'm happy to add what I
need (AFAIK, OpenJPA can't tell me what fields are loaded and its dirty
checking isn't quite right, either). But I don't want to write anything of
my own when I could be using what iBATIS provides.

So checking if a field is loaded is really weak substitute for not updating
a column that hasn't changed. I don't really need that feature. What I need
is per-field dirty tracking. CGLIB provides a basic example of making a
bound-property enhancement. I'll try to tackle that eventually unless
someone here has a better solution to the problem.

Thanks.

-- 
Daryl Stultz
_____________________________________
6 Degrees Software and Consulting, Inc.
http://www.6degrees.com
mailto:daryl@6degrees.com

Re: detect unloaded field

Posted by Clinton Begin <cl...@gmail.com>.
Sounds like you'd be half way to building Hibernate.  :-)  iBATIS doesn't
currently provide the facility to check loaded fields.

Cheers,
Clinton

On Wed, Feb 3, 2010 at 6:00 AM, Daryl Stultz <da...@6degrees.com> wrote:

> Hello,
>
> I've seen examples of a "selective update" where only non-null fields are
> written into the query. I'd like to do the same for unloaded fields. Is
> there a way I can detect if a lazy-loaded field has been loaded yet?
>
> Ultimately I'd like to do full dirty field tracking using CGLIB but I'm not
> quite ready for that.
>
> --
> Daryl Stultz
> _____________________________________
> 6 Degrees Software and Consulting, Inc.
> http://www.6degrees.com
> mailto:daryl@6degrees.com
>