May 29, 2010
@ 10:55 PM
http://dvlp.synaptic.ca/twiki/bin/view/Synaptic/NHibernateVersusiBatis
  Criteria Weighting NHibernate iBatis
F1 I don't have any control of my database design/schema 4 2 5
F2 I am driven by the relational data model because I am working with a legacy database 5 3 5
F3 My database schema will not be changing due to an already implemented data structure 3 4 5
F4 My primary keys are composite natural keys which are complex 4 1 5
F5 I am very comfortable writing SQL 4 1 5
F6 I want a tool to generate the CRUD for me 3 5 1
F7 I do not require complex queries that join more than one table 4 5 1
F8 I need a good user community 1 5 1
F9 I have deadlines that are in the distant future 1 5 1
F10 I want a free tool 2 5 5
Score 90 119

iBatis right now is MyBatis, (http://www.mybatis.org/) moved to google code

http://code.google.com/p/mybatisnet/



 
Categories: nHibernate

August 29, 2008
@ 10:41 PM
I have enabled the level2 cache for one of my old project "Asset  Management".

here are some important points to use the L2 cache:

1.  add this line to web.config nhibernate section

  <add key="hibernate.cache.provider_class"
       value="NHibernate.Caches.SysCache.SysCacheProvider,NHibernate.Caches.SysCache" />
  <add key="relativeExpiration" value="300" />

2. NHibernate.Caches.SysCache.dll have different version. it can be download from nhibernate contribution.

I didn't have one to match my nhibernate version, if you can't found the right version, you  download the source code and rebuilt it with the current nhibernate.

3. example of set entity definition file *.hbm

<class name="eg.Cat" .... >
    <cache usage="read-write"/>
    ....
    <set name="Kittens" ... >
        <cache usage="read-write"/>
        ....
    </set>
</class>

 

There are readonly|read-write|nonstrict-read-write strategies.

readonly for entities never be modified.

nonstrict-read-write for entities  be update occasionally(don't need worry about two trsaction update same entity)

 

4. the query cache is not recommended, because it stateless, but good for query the "readonly"  database tables

<add key="hibernate.cache.use_query_cache" value="true" />

IList blogs = sess.CreateQuery("from Blog blog where blog.Blogger = :blogger")
    .SetEntity("blogger", blogger)
    .SetMaxResults(15)
    .SetCacheable(true)
    .SetCacheRegion("frontpages")
    .List();


call IQuery.SetForceCacheRefresh(true) to reload the query, it is particularly if the table is updated outside of the nhibernate.
  
for the current Castle ActiveRecord, the nhibernate is 1.2, here is the doc: 
http://www.hibernate.org/hib_docs/nhibernate/1.2/reference/en/html/caches.html
http://www.hibernate.org/hib_docs/nhibernate/1.2/reference/...
http://using.castleproject.org/display/AR/Enable+second+level+cache
to understand how Level2 cache working:

Hibernate: Truly Understanding the Second-Level and Query Caches

 

Hibernate HQL And Performance

http://ayende.com/Blog/category/510.aspx 
 

 
Categories: nHibernate

NHibernate Step by Step (一) Hello,NHibernate!

 

nhibernate_template.rar (9.17 KB)

for Mysql,

provide Type use ADOXSchemaProvider

connection String:

DRIVER={MySQL ODBC 3.51 Driver};SERVER=data.domain.com;PORT=3306;DATABASE=myDatabase; USER=myUsername;PASSWORD=myPassword;OPTION=3;

 

test passed but generating failed..

Helpful tools related to NHibernate

  • HQL Analyzer and hbm.xml GUI Editor
  • ObjectMapper by Mats Helander is a mapping GUI with NHibernate support
  • MyGeneration is a template-based code generator GUI. Its template library includes templates for generating mapping files and classes from a database.
  • AndroMDA is an open-source code generation framework that uses Model Driven Architecture (MDA) to transform UML models into deployable components. It supports generation of data access layers that use NHibernate as their persistence framework.
  • CodeSmith Template for NH
  • NHibernate Helper Kit is a VS2005 add-in to generate classes and mapping files

 


 
Categories: nHibernate

http://www.cnblogs.com/bluewater/archive/2006/07/26/460174.aspx

http://wiki.nhibernate.org/display/NH/Configuring+log4net+Logging


 
Categories: nHibernate