Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / JavaBeans / April 2005

Tip: Looking for answers? Try searching our database.

Identify map

Thread view: 
Steven Wolf - 07 Apr 2005 08:48 GMT
Hi folks,

i use the identity map pattern [Fowler PoEAA] in my project, to
store/cache many domain objects there. But what happen if the
persistence data (sql) change? The user will still use some domain
objects, which are no more up-to-date. I can solve that, if i use a
server-side identity map, to provide a map for all users/apps and
update a domain object in the map when a UPDATE/INSERT/DELETE get
fired on the persitence data.

But do you have some ideas how to solve that on a client-side identity
map?

Steven.
R.F. Pels - 07 Apr 2005 09:56 GMT
> i use the identity map pattern [Fowler PoEAA] in my project, to
> store/cache many domain objects there. But what happen if the
[quoted text clipped - 6 lines]
> But do you have some ideas how to solve that on a client-side identity
> map?

Hmmm. That depends. If you access the database in such a way that the user
always has a consistent view of the data, you do not need to update the
objects, but you must resolve conflicts if the user updates/inserts/deletes
an object and its underlying representation.

Even if you notify users of changes in the underlying data, it is still
possible that they encounter a conflict if they perform a change due to a
race condition, so, conflict resolution is needed anyway.

Basically, what you do is fit the objects representing the data with methods
that check if the underlying data is still the same or still (non)existent
at the moment the user wants to propagate the changes in the object to the
database, and ask the user what to do if a conflict is raised. Or you can
adopt a scheme where 'last updater wins', for example.

Signature

Ruurd
.o.
..o
ooo

Steven Wolf - 07 Apr 2005 15:28 GMT
> Basically, what you do is fit the objects representing the data with methods
> that check if the underlying data is still the same or still (non)existent
> at the moment the user wants to propagate the changes in the object to the
> database, and ask the user what to do if a conflict is raised.

that sounds really good, something like
OnDirty()
{
  mapper.findById ( this.id )
}

i thought also about, to realease cached objects after 5 minutes, so a
user retrieve updated data max. after 5 minutes.

but anyway, thats a real good simple solution..thanks!
R.F. Pels - 07 Apr 2005 20:28 GMT
> i thought also about, to realease cached objects after 5 minutes, so a
> user retrieve updated data max. after 5 minutes.
>
> but anyway, thats a real good simple solution..thanks!

You really should look into things like hibernate for example. A lot of
stuff is already done for you in that library. Quite powerfull.

Signature

Ruurd
.o.
..o
ooo

Steven Wolf - 08 Apr 2005 09:01 GMT
> > i thought also about, to realease cached objects after 5 minutes, so a
> > user retrieve updated data max. after 5 minutes.
[quoted text clipped - 3 lines]
> You really should look into things like hibernate for example. A lot of
> stuff is already done for you in that library. Quite powerfull.

thanks, i'll look into.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.