-->
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: Architecture patterns:Repository pattern, Table Data Gateway
PostPosted: Thu Jan 17, 2008 3:45 pm 
Newbie

Joined: Wed Nov 22, 2006 7:28 am
Posts: 12
Hi all

I am working on a system using NHibernate 1.2 (ok it's not on the right forum but my queries still do apply I think) where we use the Repository pattern to provide us with CRUD commands to our database.
In terms of layers separation, we've got:
- A services layer which is here to respond to users of the system whether it is a UI or a web service, this layer uses a generic IRepository implementation and some specific ones (like IUserRepository) to perform data manipulation. This layer is obviously as well dependent upon our business layer
- The business layer that contains all our business objects and that includes data + behaviour.

We chose to try to put as much of the business logic inside the business object themselves as possible.
I don't know if this is a wise move because we made an architectural decision that the domain model cannot use the IRepository interface.

On really tricky issue is how I would go to implement the Table Data Gateway in the domain model without compromising our architecture.

For instance, I may have a method on a Person that says that it will relate a Person object to all of the countries starting with the letter "X".
Because, and as I see it, our domain model only works if objects are some form of Active Records.
Person being an domain model representation of one row of the Persons table.
Now my real issue is that with using the IRepository pattern where it's not available to the domain model how would I get access to all (or some using some kind of specification) from a given type ?

Another big issue I've got with not being able to use the IRepository is that how could I implement some business logic where some objects need to be deleted depending on some business rule. Because I don't have the IRepository instance I woudln't be able to do a .Delete(entity) which would ultimately do a ISession.Delete(entity) ??

Many thanks to any pointer!


Top
 Profile  
 
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.