Discussion:
[castor-dev] Caching question
August Detlefsen
2010-02-11 22:28:32 UTC
Permalink
I have a mapped object with a number of layers of sub objects:

Dashboard
-> Section (ArrayList)
-> SectionItem (ArrayList)
-> Item

Item has cache-type="none" specified in the mapping, but all of the other classes in the tree have no cache-type specified and thus use the default count-limited cache.

My question is: If I make an update to an Item, and then db.load the main Dashboard object, will it include the newly updated Item, or will I get a cached Dashboard object that also includes an older cached version of the Item that was just modified?

Thanks,
August






---------------------------------------------------------------------
To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email
Ralf Joachim
2010-02-12 07:17:43 UTC
Permalink
Hi August,

I expect the update of the Item happens directly on the database and not
through Castor.

If you have an open transaction which previously loaded the unchanged
Item before the update and you load the Item once again through this
transaction, you will get the same Item instance which does not reflect
the modification. When loading the Item in a transaction which began
after the update, you should get the changed Item. It does not matter
wether the Item is loaded directly with db.load(Item.class,...) or
inirectly with db.load(Dashboard.class,...).

Regards
Ralf
Post by August Detlefsen
Dashboard
-> Section (ArrayList)
-> SectionItem (ArrayList)
-> Item
Item has cache-type="none" specified in the mapping, but all of the other classes in the tree have no cache-type specified and thus use the default count-limited cache.
My question is: If I make an update to an Item, and then db.load the main Dashboard object, will it include the newly updated Item, or will I get a cached Dashboard object that also includes an older cached version of the Item that was just modified?
Thanks,
August
---------------------------------------------------------------------
http://xircles.codehaus.org/manage_email
--
Syscon Ingenieurbüro für Meß- und Datentechnik GmbH
Ralf Joachim
Raiffeisenstraße 11
72127 Kusterdingen
Germany

Tel. +49 7071 3690 52
Mobil: +49 173 9630135
Fax +49 7071 3690 98

Internet: www.syscon.eu
E-Mail: ***@syscon.eu

Sitz der Gesellschaft: D-72127 Kusterdingen
Registereintrag: Amtsgericht Stuttgart, HRB 382295
Geschäftsleitung: Jens Joachim, Ralf Joachim




---------------------------------------------------------------------
To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email
August Detlefsen
2010-02-12 19:25:16 UTC
Permalink
I am using a Castor transaction to update the item: I db.load() the Item (without loading the actual Dashboard it belongs to), make a change and then db.commit().





----- Original Message ----
From: Ralf Joachim <***@syscon.eu>
To: ***@castor.codehaus.org
Sent: Thu, February 11, 2010 11:17:43 PM
Subject: Re: [castor-dev] Caching question

Hi August,

I expect the update of the Item happens directly on the database and not
through Castor.

If you have an open transaction which previously loaded the unchanged
Item before the update and you load the Item once again through this
transaction, you will get the same Item instance which does not reflect
the modification. When loading the Item in a transaction which began
after the update, you should get the changed Item. It does not matter
wether the Item is loaded directly with db.load(Item.class,...) or
inirectly with db.load(Dashboard.class,...).

Regards
Ralf
Post by August Detlefsen
Dashboard
-> Section (ArrayList)
-> SectionItem (ArrayList)
-> Item
Item has cache-type="none" specified in the mapping, but all of the other classes in the tree have no cache-type specified and thus use the default count-limited cache.
My question is: If I make an update to an Item, and then db.load the main Dashboard object, will it include the newly updated Item, or will I get a cached Dashboard object that also includes an older cached version of the Item that was just modified?
Thanks,
August
---------------------------------------------------------------------
http://xircles.codehaus.org/manage_email
--
Syscon Ingenieurbüro für Meß- und Datentechnik GmbH
Ralf Joachim
Raiffeisenstraße 11
72127 Kusterdingen
Germany

Tel. +49 7071 3690 52
Mobil: +49 173 9630135
Fax +49 7071 3690 98

Internet: www.syscon.eu
E-Mail: ***@syscon.eu

Sitz der Gesellschaft: D-72127 Kusterdingen
Registereintrag: Amtsgericht Stuttgart, HRB 382295
Geschäftsleitung: Jens Joachim, Ralf Joachim




---------------------------------------------------------------------
To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email




---------------------------------------------------------------------
To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email
Werner Guttmann
2010-02-12 19:18:45 UTC
Permalink
Hi August,

my guess is that you will *not* get any cached verions of Item
instances. Here's why: when Castor resolves a relation between two
classes (object instances), it will eventually issue a

Database.load(Item.class, ...)

down the line. If there's no cache enabled, Castor will load the actual
objects (their values) from the database.

Cheers
Werner
Dashboard -> Section (ArrayList) -> SectionItem (ArrayList) ->
Item
Item has cache-type="none" specified in the mapping, but all of the
other classes in the tree have no cache-type specified and thus use
the default count-limited cache.
My question is: If I make an update to an Item, and then db.load the
main Dashboard object, will it include the newly updated Item, or
will I get a cached Dashboard object that also includes an older
cached version of the Item that was just modified?
Thanks, August
---------------------------------------------------------------------
http://xircles.codehaus.org/manage_email
---------------------------------------------------------------------
To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email
Loading...