Collection being eagerly loaded, even though lazy = true?

Never used xml-based entity description, but the the link below might be useful for you.

Never used xml-based entity description, but the the link below might be useful for you. java.sun.com/javaee/6/docs/api/javax/per... Defines strategies for fetching data from the database. The EAGER strategy is a requirement on the persistence provider runtime that data must be eagerly fetched.

The LAZY strategy is a hint to the persistence provider runtime that data should be fetched lazily when it is first accessed. The implementation is permitted to eagerly fetch data for which the LAZY strategy hint has been specified. Another question is how you determine that competitors are eagerly loaded.

For example any call to getCompetitorsList().size() will cause the list to be loaded. If this is not the case you should look for hibernate-specific configuration options which could guarantee lazy loading.

Thanks for the response, I am using plain not JPA and lazy strategy is set. Regarding the second question, I have updated the post containing that info. – Distortion Sep 1 at 23:15.

You are using one-to-one association. Don't. Your usage means the league and the champion have the same primary key.

The correct inverse of many-to-one is "set" I cannot tell the arity from your description. But if a league has a single champion then in League you should have: likewise your "list" of competitors should probably be a set unless you have a reason for ordering the competitors. Btw whats with all the spaces at the beginning of class names?

Update: How do you know the list is being fetched eagerly? I would suggest turning on sql logging to make sure the debugging is not causing the problem. Remove the fetch attributes.

Fetch affects loading and has side-effects on loading. Use org.hibernate. IsInitialized(league.

CompetitorList) to find out if the list is truly initialized. This log4j. Xml snippet will help with the logging to determine exactly when the collection is fetched.

I have added class model in order to bring some semantic here. Actually I am using many to one with unique=true as described here: docs.jboss. Org/hibernate/core/3.5/reference/en/html/… .

The League-Championship association is not bidirectional, a Championship has a default league (many-to-one unique from Championship to league) and as a separate thing Leagues belong to a Championship (the one-to-one was an error, I have edited that) – Distortion Sep 1 at 22:53 Please see my updates on Notes 3 and 4. Thanks! – Distortion Sep 2 at 22:43.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions