Hi Adam,
If you reload data every time, why would you need cache in between the
transactions? If your app can update the same instance in multiple threads,
you'd use optimistic concurrency with a version column.
regards,
-marina
Adam Bien wrote:
> Hi Kim,
>
> but this shouldn't be the default bevior. No J2EE developer would expect
> such configuration.
> In an average Java EE environment (many clients use the same database),
> the data could become inconsistent,
>
> regards,
>
> adam
> Wonseok Kim schrieb:
>
>>
>>
>> On 8/15/06, *Adam Bien* <abien_at_adam-bien.com
>> <mailto:abien_at_adam-bien.com>> wrote:
>>
>> Hi Marina,
>>
>>
>> Marina Vatkina schrieb:
>> > Hi Adam,
>> >
>> > Are you asking about CMP or Java Persistence implementation?
>> > They are based on 2 different code bases in glassfish ('cmp'
>> > and 'entity-persistence' sub-modules).
>> >
>> > CMP supports version consistency, and as such "caching between
>> > transactions" for those beans that choose to use this consistency
>> > level. It also supports read-only CMPs which states are cached
>> for a
>> > period of time (refresh interval).
>> >
>> > JPA implementation always uses "caching between transactions",
>> > and you need to call an explicit refresh, to reload an instance
>> > from a database (like you have by default in CMP).
>> >
>> Really, I would expect, that in every new transaction I would get
>> fresh
>> data from database?
>>
>>
>> I don't think so. Even in a transaction-scoped persistence context,
>> TopLink caches entities in the sesion cache so if you do em.find() you
>> will get cached result. You can call em.refresh() after em.find() or
>> execute query with query hint "toplink.refresh" to get fresh one from
>> database.
>> - Wonseok
>>
>> Thanks,
>>
>>
>>
>> adam
>> > HTH.
>> >
>> > Regards,
>> > -marina
>> >
>> > Adam Bien wrote On 08/14/06 08:11,:
>> >
>> >> I read the following thread:
>> >> http://www.theserverside.com/news/thread.tss?thread_id=41748
>> <http://www.theserverside.com/news/thread.tss?thread_id=41748>
>> >>
>> >> Do glassfish not support the notion of "caching between
>> transactions"
>> >> or commit-option A (from CMP 2.1)?
>> >>
>> >> This is important for real world...
>> >>
>> >> regards,
>> >>
>> >> adam
>> >>
>> >>
>> >>
>> >
>> >
>>
>>
>> --
>> Dipl. Inf. adam bien
>>
>> BEA Technical Director
>> Sun Certified Java Programmer
>> Sun Certified Enterprise Java Architect
>> Sun Enterprise Java Trainer
>>
>> Mobile: 0049(0)170 280 3144
>> eMail: abien_at_adam-bien.com <mailto:abien_at_adam-bien.com>
>> Homepage: www.adam-bien.com <http://www.adam-bien.com>
>> Weblog: http://www.adam-bien.com/roller/page/abien
>> ----------
>> Book author:
>>
>> Enterprise Architekturen
>> entwickler.press 2006
>> ISBN: 393504299X
>>
>> and Enterprise Java Frameworks,
>> J2EE Patterns, J2EE HotSpots and Struts.
>>
>>
>>
>>
>> --
>> Wonseok Kim
>> Senior Developer, TmaxSoft
>
>
>