Lazy initialization on single ended asociation and list/map collection type ---------------------------------------------------------------------------
Key: HIB-130 URL: http://jira.andromda.org/browse/HIB-130 Project: Hibernate Cartridge Type: Bug Versions: 3.1-RC1 Reporter: Sverker Abrahamsson Assigned to: Carlos Cuenca I'm reporting two issues on the same time, sorry for that but they affects the same lines in the template so it's difficult to separate. Issue 1: Lazy loading of single-ended asociations does not work since lazy="true" does not give the expected behaviour. The Hibernate doc is a bit confusing on that issue but in the upcomming 3.1 release it's clearly explained that there are three valid values for the lazy attribute: proxy, no-proxy and false. Proxy means that a lazy-load proxy is used instead of eager loading the asociation. No-proxy means that instead of using a proxy, the bytecode is manipulated to accomplish the same functionality. False means that the asociation is eager loaded. Ironically lazy="true" means that the asociation is eagerly loaded. I also noticed that setting fetch="join" overides the lazy setting, causing an eager load, so instead I let it depend on the lazy tagged value so that if a asociation is to be lazy, fetch="select" is used. If an asociation is to be eager loaded it can be controlled by namespace parameter or tagged value if it is done using join or select. Issue 2: I noticed that it did not work to set collection type to map because Map cannot be casted to a Collection. I also saw that it used the depreciated tag index to specify map key. I've done the following changes: * If not specificCollectionInterfaces is true then map association will use Map interface and Collection subclasses (such as Set and List) use Collection interface. That is since Map cannot be casted to a Collection. * I believe there is a bug when using namespace parameter associationEndCollectionIndexType. That is solved now so that it can look up e.g. datatype::String. * I've set default collection index type to be datatype::String by setting default value on the namespace parameter. Keep it if you want but I believe there should be reasonable defaults which can be modified by settings. Hibernate defaults to VARCHAR if this attribute is not specified. * I've also added generation of index column name (for map and list asociations) which is used unless it is specified by either namespace parameter or tagged value. It's an optional parameter, Hibernate itself calls it "idx" if not specified. ------------------------------------------------------- SF.Net email is Sponsored by the Better Software Conference & EXPO September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf