Archive for the ‘Hibernate’ Category
Hibernate Query Optimization and lazy loading
The problem: For each object that Hibernate loads, it needs to do one or more extra SQL queries to load associated objects. (Potentially as many as Kn + 1, where n is the number of objects returned). Example: Simplified hibernate mapping file <class name=”Department”> … <many-to-one name=”employee”…/> … </class> Simple HQL Query from Department dept where dept.location like [...]
In: Hibernate, IT · Tagged with: Hibernate, Open Source
Hibernate Caching
Hibernate uses two different caches for objects: first-level cache and second-level cache first-level cache Associates with the Session object (Available for the transactions in the same session) second-level cache Associates with the Session Factory object (Available for the entire application) Cache Implementations in Hibernate EHCache (Easy Hibernate Cache) org.hibernate.cache.EhCacheProvider It is fast. lightweight. Easy-to-use. Supports read-only and read/write caching. Supports memory-based and disk-based caching. Does not support clustering. OSCache (Open [...]
