NHibernate Performance Object Relational Mapper For .Net - PowerPoint PPT Presentation

1 / 6
About This Presentation
Title:

NHibernate Performance Object Relational Mapper For .Net

Description:

from Blog blog left join fetch blog.Posts. where :user in elements(blog.Users) ... objects in memory, access one Blog's Posts collection, loads for the first 10 ... – PowerPoint PPT presentation

Number of Views:307
Avg rating:3.0/5.0
Slides: 7
Provided by: oren4
Category:

less

Transcript and Presenter's Notes

Title: NHibernate Performance Object Relational Mapper For .Net


1
NHibernate PerformanceObject Relational
MapperFor .Net
  • Oren Eini
  • Orene_at_we-can.co.il

2
Eager Fetching
  • Using HQL
  • from Blog blog left join fetch blog.Posts
  • where user in elements(blog.Users)
  • Left / inner joins are supported.
  • Using Criteria API
  • SetFetchMode(Orders, FetchMode.Eager)
  • outer-jointrue
  • max fetch depth
  • Only one collection, but multiple references.

3
Batch Fetching
  • Loads other objects associations.
  • 100 Blog objects in memory, access one Blogs
    Posts collection, loads for the first 10 objects.
  • batch-size10
  • On classes
  • On associations

4
Caching
  • Session Cache Called First Level Cache. Cache
    the instances of the objects.
  • Session Factory Cache Called Second Level
    Cache. Cache the individual values, relationships
    do not stale.
  • Requires adding ltcache usage'read-onlyread-write
    nonstrict-read-write'/gt to the mapping of the
    class.
  • Requires adding the same tag to any association
    as well.
  • Can define regions for queries.
  • Session.CreateQuery(from Blog blog where
    blog.Blogger blogger).SetEntity(blogger,blo
    gger).SetMaxResults(15) .SetCacheable(true).SetCa
    cheRegion(foo).List()
  • Cache regions can be configured independantly.

5
Miscellaneous Tips
  • dynamic-updatetrue, dynamic-inserttrue
  • useful in some cases, if the object has a large
    column.
  • Prefer not to use, since it means that the server
    cant cache plans as easily.
  • Can set a reference (property) to lazy, and it
    will be loaded on demand.
  • Accessing the Primary Key of an object will never
    cause a database call.

6
Questions Comments
Orene_at_we-can.co.il
Write a Comment
User Comments (0)
About PowerShow.com