-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 
Author Message
 Post subject: Pattern discussion : Real time modification
PostPosted: Sat Jan 19, 2008 12:21 pm 
Newbie

Joined: Wed Jun 27, 2007 11:30 am
Posts: 12
Hi Hibernate community,

I'm relatively new to Hibernate but I'm facing "non standard" problem. A lot of blogs, books and tutorials speak about Hibernate-Spring-[Insert your Web framework here]. But my concern is a bit different, my web framework can simulate a "connected Mode" with Ajax and Reverse Ajax. Like googleDoc, this allows to build "nearly realtime" application : a user modification on an element is immediately seen by another user.

Like an heavy client in a Client/Server architecture, I'm searching patterns, advices and tips to make use of Hibernate in this situation.

Actually I'm using the classic 3-Tiers pattern : DAO - Service - Presentation, with an open Session in view pattern and some helper classes to perform automatic reassociations.
My first idea is to add a fourth layer between Service and Presentation to make another "Entity" cache shared by all users (actually we have the Hibernate Session cache wich is associated to a single HTTPsession ). The first user which select an element add it in this cache where the second user can retreive the *same* reference so modifications made by the two users will be shared...

I am right ? Where Can I find further informations ? Is there an option to make an application scoped cache instead of session scoped ?

Thanks in advance,
See you soon


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jan 19, 2008 3:02 pm 
Expert
Expert

Joined: Tue Nov 23, 2004 7:00 pm
Posts: 570
Location: mostly Frankfurt Germany
EventListener might be interesting to have a hook on objects which have
changed.

The design pattern is probably a Observer calling back all applications and informing them about the changed objects.

_________________
Best Regards
Sebastian
---
Training for Hibernate and Java Persistence
Tutorials for Hibernate, Spring, EJB, JSF...
eBook: Hibernate 3 - DeveloperGuide
Paper book: Hibernate 3 - Das Praxisbuch
http://www.laliluna.de


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jan 20, 2008 5:40 am 
Newbie

Joined: Wed Jun 27, 2007 11:30 am
Posts: 12
Hi, thanks for your reply. Yes Event Listener with Observer Pattern is a nice Pattern for that. However what do you suggest ?

On entity change do I have to force all users to reload their entity version with a lock(entity,LockMode.READ) ?
Or either do I have to maintain a global cache manually because Hibernate does'nt "merge" between Hib Sessions ?

And what about manually synchronizing entites : the first user loads an entity which will be shared between all futures user (with something that force entity injection on Hibernate Sessions without DB call ) ?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 21, 2008 2:19 pm 
Newbie

Joined: Wed Jun 27, 2007 11:30 am
Posts: 12
Ouch a good soul have an idea ?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.