Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] Full Identity Map that has relationships to objects cached in weaker types

I think I have found an elegant solution that preserves the entity
relationship model and also offers FullIdentityMap caching for all User
entities and "real" WeakIdentityMap caching for all Message entities. The
magic word here is proxy.

A UserProxy entity is all that we need. Every User has one UserProxy that
has exactly the same primary key as the User. UserProxies are cached in a
WeakIdentityMap. The User does not have a relationship to UserProxy and the
UserProxy does not have a relationship to User. The only thing they have in
common is the primary key. The User does not have a relationship to Messages
anymore. But the UserProxy now has a OneToMany relationship to Messages. 

So whenever we want to access some Messages of a User (full cached), we load
his UserProxy (weak cached) that loads the Messages (weak cached). This way
all Messages can be garbage collected - always.

View this message in context:
Sent from the EclipseLink - Users mailing list archive at

Back to the top