ibatis-user-cs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Carlos Peix" <peix-lis...@praxia.com.ar>
Subject Caching
Date Sat, 10 Jun 2006 18:43:20 GMT
Hi Alexandre,
Hi all,

In which level the cache you mention would work?

Let me explain my question.

I'm wondering how you (and my other fellows) manage with different instances for
de same (conceptual) entity. As I tested, IBatis builds new instances on each

This is causing me problems with the integrity of the domain model, for example,
if I code:

OperatingUnit firstInstance =
  (OperatingUnit)Mapper.QueryForObject( "OperatingUnitById", 1 );

OperatingUnit secondInstance =
  (OperatingUnit)Mapper.QueryForObject( "OperatingUnitById", 1 );

IBatis returns two different instances of the “same entity”.

or, if I have a OperatingUnit object and a Customer object and the Customer
object has a reference to a OperatingUnit:

OperatingUnit operatingUnit =
  (OperatingUnit)Mapper.QueryForObject( "OperatingUnitById", 1 );

Customer myCustomer =
  (Customer)Mapper.QueryForObject( "CustomerById", 10 );

( myCustomer.OperatingUnit == operatingUnit ) will return false

( myCustomer.OperatingUnit.Id == operatingUnitId ) will return true

Of course, the problem gets very ugly if you modifiy both instances.

How do you handle this?



View raw message