You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-cs@ibatis.apache.org by Arjen Smits <ar...@ProPlanet.nl> on 2006/08/10 08:48:14 UTC

Confirmation about how ibatis fills the objects it maps to?

I have an question concerning how ibatis fills the object it maps its
data to.

 

I know it uses the properties of an object to set its data. However in
what sequence does it do this? Does it first initialises the field by
setting it to null? Or does it do some other form of initialisation
first before filling the object with the actual data?

 

The reason I am asking is because currently I implemented an sort of
data integrity checking in the data object.

However ibatis triggers the error mechanism when it try's to set the
data in the object.

For example:

 

I got an Class User. This class has the String Username property.

In the set procedure of this property I check if the value being used is
not null and the string is longer then 0. If it is I throw an
specialised exception.

 

So what happens now is that when I query the database with an select and
ibatis tries to fill the user object it throws this specialised
exception, indicating that the value being used is either null or an
empty string. After some debugging I found out it actually fills it with
an empty value first, afore putting in the "real" value.

 

So it seems to initialise the object first with empty values.

 

Can I get confirmation of this behaviour ?