Defining the global fetch plan collections; they can be mapped as extra lazy. For example, consider the collection of bids of an Item: … The collection wrapper is now smarter than before. The collection is no longer initialized if you call size(), contains(), or isEmpty() the database is queried to retrieve the necessary information. If it s a Map or a List, the operations containsKey() and get() also query the database directly. A Hibernate extension annotation enables the same optimization: @OneToMany @org.hibernate.annotations.LazyCollection( org.hibernate.annotations.LazyCollectionOption.EXTRA ) private Set bids = new HashSet(); Let s define a fetch plan that isn t completely lazy. First, you can disable proxy generation for entity classes. 13.1.4 Disabling proxy generation Proxies are a good thing: They allow you to load only the data that is really needed. They even let you create associations between objects without hitting the database unnecessarily. Sometimes you need a different plan for example, you want to express that a User object should always be loaded into memory and no placeholder should be returned instead. You can disable proxy generation for a particular entity class with the lazy=”false” attribute in XML mapping metadata: …
Check Tomcat Web Hosting services for best quality webspace to host your web application.
This entry was posted
on Sunday, January 20th, 2008 at 4:05 pm and is filed under j2ee.
You can follow any responses to this entry through the RSS 2.0 feed.
You can leave a response, or trackback from your own site.