|
View:
New views
4 Messages
—
Rating Filter:
Alert me
|
|
|
Notifications about external database changesHello,
I am having a little trouble understanding how my EntityManager could be informed about changes to the database that were made by a 3rd Party program in another process. Is there any recommended way to reload/refresh the entities in the entity manager? I am currently using "eclipselink.refresh=true" as a query hint in my getResultList() calls. But once you forget that, you will not see external changes. Is there a way to globally turn of entity caching? Also is there a "non-pull" way of getting notified about changes in tables from outside? My application needs to monitor progress on orders and currently I am polling every 10 seconds to do a full entity update using a "select e from SendOrder e" query. Which is of course highly inefficient. I could use DB-triggers but they cannot be managed by JPA and are not available on every database. Any ideas? Thanks, Phil _______________________________________________ eclipselink-users mailing list eclipselink-users@... https://dev.eclipse.org/mailman/listinfo/eclipselink-users |
|
|
RE: Notifications about external database changesA fast implementation compatible with caching is that your DB send to
your application a JMS invalidation message containing the table name + PK modified, likely implemented using triggers. In Oracle DB, it's relatively easy, because already supporting JMS. Then your application can match entities by using the table name received. This way you just have a small window of stale data, which you can protect using optimistic locking. -----Original Message----- From: eclipselink-users-bounces@... [mailto:eclipselink-users-bounces@...] On Behalf Of Philipp Kursawe Sent: Monday, June 08, 2009 4:14 PM To: eclipselink-users@... Subject: [eclipselink-users] Notifications about external database changes Hello, I am having a little trouble understanding how my EntityManager could be informed about changes to the database that were made by a 3rd Party program in another process. Is there any recommended way to reload/refresh the entities in the entity manager? I am currently using "eclipselink.refresh=true" as a query hint in my getResultList() calls. But once you forget that, you will not see external changes. Is there a way to globally turn of entity caching? Also is there a "non-pull" way of getting notified about changes in tables from outside? My application needs to monitor progress on orders and currently I am polling every 10 seconds to do a full entity update using a "select e from SendOrder e" query. Which is of course highly inefficient. I could use DB-triggers but they cannot be managed by JPA and are not available on every database. Any ideas? Thanks, Phil _______________________________________________ eclipselink-users mailing list eclipselink-users@... https://dev.eclipse.org/mailman/listinfo/eclipselink-users _______________________________________________ eclipselink-users mailing list eclipselink-users@... https://dev.eclipse.org/mailman/listinfo/eclipselink-users |
|
|
Re: Notifications about external database changesOn Tue, 09 Jun 2009 02:33:52 +0200, Sebastien Tardif
<stardif@...> wrote: > A fast implementation compatible with caching is that your DB send to > your application a JMS invalidation message containing the table name + > PK modified, likely implemented using triggers. In Oracle DB, it's > relatively easy, because already supporting JMS. Then your application > can match entities by using the table name received. How would I setup such JMS scenario? Which topics I would need to subscribe to? Thanks, for any help, Phil _______________________________________________ eclipselink-users mailing list eclipselink-users@... https://dev.eclipse.org/mailman/listinfo/eclipselink-users |
|
|
Re: Notifications about external database changesYou can disable the shared cache using the persistence.xml property,
"eclipselink.cache.shared.default"="false" Trigger or specific database mechanism are the only way to get events from the database. You could maintain a open/changed or change number column in your tables that the external application must update, so you can at least limit your polling query to filter on that column.
James Sutherland EclipseLink, TopLink Wiki: EclipseLink, TopLink Forums: TopLink, EclipseLink Book: Java Persistence |
| Free embeddable forum powered by Nabble | Forum Help |