detect unloaded field

2010-02-03 Thread Daryl Stultz
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

How to throw an exception when a property from a parameter map is null or missing?

2010-02-03 Thread Paul Spencer
Is there a way to throws an exception if an property from the input parameter evaluates to null in iBatis 3.0? I have a generic query engine that accepts iBatis configuration files and a parameter map as input. As a result the query engine only passes the parameter map to iBatis without kn

Re: detect unloaded field

2010-02-03 Thread Clinton Begin
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 wrote: > Hello, > > I've seen examples of a "selective update" where only non-null fields are > written i

Re: How to throw an exception when a property from a parameter map is null or missing?

2010-02-03 Thread Clinton Begin
This enters a very big topic of validations in the persistence layer, which I would approach very carefully and not simply add a few attributes here and there. I believe this should be done at a higher level in your application. While it may be convenient to piggyback on the iBATIS configuration

Re: detect unloaded field

2010-02-03 Thread Daryl Stultz
On Wed, Feb 3, 2010 at 9:16 AM, Clinton Begin 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 wonder

Re: How to throw an exception when a property from a parameter map is null or missing?

2010-02-03 Thread Guy Rouillier
On 2/3/2010 8:36 AM, Paul Spencer wrote: Ideally I would like to use a mode in the query parameter, like #{col2Value,nonNullValue=required}, that would cause iBatis to throw an exception when the property evaluated to null. If you are willing to impose a clause like that above, then just requi

Re: Mapper parsing problem

2010-02-03 Thread Marco Speranza
Hi Clinton, thanks for your reply, I understand that's a design choice but I sadly noticed that when the property parameter contains a break line character, iBatis raises a so generic error that I had to spend a lot of time to understand what was the cause... So, yesterday I spent a good part of t

Re: Mapper parsing problem

2010-02-03 Thread Simone Tripodi
Hi all, just my 2cents: even if I'm familiar with XML SQL maps, I've always found the property parameter a little confusing into iBatis, since adds a new syntax in the XML syntax, indeed I was a great fan of iBatis2 ParameterMap. IMHO a "nice to have" in the SQL map is something like: instea

Re: Mapper parsing problem

2010-02-03 Thread Simone Tripodi
Forgot to say that, of course, there are cons, like in the sample below: insert into users (id, username, password) values (, ) is much more verbose than: insert into users (id, username, password) values (#{id}, #{username}, #{password}) All the best ;) Simo http://people

Re: Mapper parsing problem

2010-02-03 Thread Daryl Stultz
On Wed, Feb 3, 2010 at 3:32 PM, Simone Tripodi wrote: > Forgot to say that, of course, there are cons, like in the sample below: > > I misread your first post and was thinking you wanted something like this: insert into users (id, username, password, department) values (#{id}, #{user

Re: Mapper parsing problem

2010-02-03 Thread Clinton Begin
This was actually a very serious consideration for us. I personally like this design a lot. FWIW: Parameter maps are in iBATIS 3, but the DTD disables the element. Primary reason is that it still works exactly like iBATIS 2, which is not based on named parameters as you've suggested. Before add

Re: Mapper parsing problem

2010-02-03 Thread Guy Rouillier
On 2/3/2010 3:54 PM, Daryl Stultz wrote: On Wed, Feb 3, 2010 at 3:32 PM, Simone Tripodi mailto:simone.trip...@gmail.com>> wrote: Forgot to say that, of course, there are cons, like in the sample below: I misread your first post and was thinking you wanted something like this: inse

Re: Mapper parsing problem

2010-02-03 Thread Daryl Stultz
On Wed, Feb 3, 2010 at 7:38 PM, Guy Rouillier wrote: > On 2/3/2010 3:54 PM, Daryl Stultz wrote: > >> I like this idea, though to keep things consistent, I would just use >> "parameter" instead of "parameterDef". >> > Right, I just made up parameterDef to indicate is was for defining the parameter

Re: Mapper parsing problem

2010-02-03 Thread Simone Tripodi
Hi all guys, sorry but I explained my "2 cents idea" in the wrong way :P Indeed, in my dreams, I'd completely _remove_ the #{} syntax, IMHO it should be simpler reading a 100% pure XML SQL map like: update ORDER_ENTRY.CONTACT set DEPT_ID = STATE_ID = TIME_ZONE_ID = instead of update ORD