You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Kalle Korhonen <ka...@gmail.com> on 2009/11/16 22:12:55 UTC

Best practice for database notifications?

I've got a typical Tapestry-hibernate webapplication. There's some
data stored in the database that never really changes (until it does)
and some selected services read it at start-up, then cache it (an
example of this data is an external soap service address). To avoid
having to restart the webapplication to refresh the data in the
services, what's the best way to do database to service notifications?

In the past, I've used custom Hibernate interceptors to do this with a
few different communication mechanism depending on whether I have a
single or multiple webapps that operate on the same data. I could use
the same or as a simple hack, I could just inject the service and
update it on the page/service that handles the edit transaction.
However, as a generic best practice, I wonder if somebody's already
built something for this - for example a configurable Hibernate entity
interceptor advisor similar to HibernateTransactionAdvisor?

Kalle

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Best practice for database notifications?

Posted by Kalle Korhonen <ka...@gmail.com>.
Thanks Thiago. Yes, 2nd level cache is great for some use cases and I
use them whevever possible but not in this case - when this data
changes, the new data needs to picked up immediately. Evicting the
cache doesn't give me much more - I still need to add in the logic to
evict it - although, a configurable cache evicting Hibernate
transaction advisor would be simpler to write... hmm maybe you got
something there. Any other takers?

Kalle


On Mon, Nov 16, 2009 at 2:20 PM, Thiago H. de Paula Figueiredo
<th...@gmail.com> wrote:
> What about using a second-level cache in Hibernate and configure it to live
> for a couple hours? You can also use the SessionFactory methods that clear
> the second level cache programatically: evict(Class persistentClass) and
> evictQueries(String cacheRegion).
>
> --
> Thiago H. de Paula Figueiredo
> Independent Java, Apache Tapestry 5 and Hibernate consultant, developer, and
> instructor
> Owner, software architect and developer, Ars Machina Tecnologia da
> Informação Ltda.
> http://www.arsmachina.com.br
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Best practice for database notifications?

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
What about using a second-level cache in Hibernate and configure it to  
live for a couple hours? You can also use the SessionFactory methods that  
clear the second level cache programatically: evict(Class persistentClass)  
and evictQueries(String cacheRegion).

-- 
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,  
and instructor
Owner, software architect and developer, Ars Machina Tecnologia da  
Informação Ltda.
http://www.arsmachina.com.br

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org