-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Practice: What works?
PostPosted: Fri Nov 18, 2005 4:54 pm 
Hi folks,

I was wonder if you'd share the set of practices/policies you have implemented in your project that work for you. I'm talking about whole set, not only "one session per application/request/whatever".

I'm fairly new to NHibernate but this rules work for me so far on an ASP.NET project:

0) Single assembly for the whole domain model.

1) Session-per-request, the session is for reads only (FlushMode=Never), with separate new session on the same connection for each transaction.

2) Mapped entities are ignorant of the persistence framework.

3) Persistence and queries are performed by separate "doer" classes (typically some sort of manager implementing FindXByID(), SaveX() and the like).

4) Save parent, cascade to children.

5) Evict-SaveOrUpdate-Lock/Refresh

6) Map relationship to reference table as as IDs instead of entity. (There is hardly ever a need to dereference those)

7) All entities requiring an audit trail implement a single interface and an interceptor checks for the interface and creates the actual trail.

8) All reference entities implement a method (interface) to return a simple key-value object that could be used to bind to UI elements (such as dropdowns).

9) Unit test.


Any takers?

TIA,
E.


Top
  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.