openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Dick <michael.d.d...@gmail.com>
Subject Re: Monitoring a database table or individual record for changes?
Date Thu, 11 Jun 2009 02:34:43 GMT
Hi Pablito,

I know this isn't exactly what you asked for but if you're using the same
database instance and the same PersistenceUnit then it might be easier to
use a L2 DataCache [1].

The L2 cache can be shared between all EntityManagers created by a single
EntityManagerFactory (or PersistenceUnit). There are also ways to keep the
cache synchronized if it's running on different JVMs (the manual is a good
starting point for that).

[1]
http://openjpa.apache.org/builds/latest/docs/manual/manual.html#ref_guide_caching

If you want to be notified to act on the changes (not just to make sure you
have the most up to date changes) then you'll need a callback like you
suggested. Sadly I'm not aware of such a callback in OpenJPA. Others on the
list might know though.

Hope this helps and let us know if you have other questions,
-mike

On Wed, Jun 10, 2009 at 4:26 PM, pablito <paul9375@gmail.com> wrote:

>
> Hi:
>
> I apologise for the newb question, but I'm a still a bit inexperienced when
> it comes to the database scene. Basically, I expect to have a number of
> servlets using a same database instance (under MySql if that matters). Is
> there any way to register a callback against a table or even a particular
> record for changes? Basically, I'm looking at a scenario where different
> servlets (in Tomcat) are interested in the same table/record and need to
> know to re-read the data when it changes.
>
> I ask here as we will be using OpenJpa, but I can't say I'm aware if
> databases generally have this capability. To be clear, I've looked at the
> Lifecycle callbacks, but I'm assuming that this isn't meant to cut across
> process boundaries. I'm just looking for confirmation either way.
>
> Many thanks,
> Pab
> --
> View this message in context:
> http://n2.nabble.com/Monitoring-a-database-table-or-individual-record-for-changes--tp3058495p3058495.html
> Sent from the OpenJPA Users mailing list archive at Nabble.com.
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message