Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[eclipselink-users] cache, eager loading and bi-directional relationships

Hi,

I am doing some brainstorming with a few colleagues and some are saying that we:

1 - should disable global cache because cache does not make a big difference and if database is in the same network then it should be fast enough
2 - better not use bi-directional relationships because it brings more complexity and at the end it is always possible to get the same results with a few more queries
3 - when it is necessary to serialize entities to send to the client (GWT or Swing apps for example) it is a good idea to configure all relationships as EAGER and remove some relationships to avoid to much data to be sent (when a relationship is marked as LAZY it will have a Set implementation that results in an empty set when a detached entity is serialized)

Personally I don't agree with any of those arguments and would appreciate if anybody can help me with some counter arguments.

My view is:

1 - yes we can have problems with cache if we don't handle bidirectional relationships correctly or if we mix attached and detached entities in a relationship, I also think that cache really makes a difference and that it should be used unless there is a very good reason to do so, for example when a table can be changed by other systems
2 - bidirectional relationships allow us to create simpler queries and write less code and if they are coded correctly there should not be any problems
3 - we should use EAGER only when it makes sense to really load something every time we load a related entity, otherwise it is better to control what is going to be loaded with some query hints or just by calling relationship getters just before the entity gets serialized

Thanks a lot,
    Constantino



Back to the top