-->
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: Introducing NHibernate where Repositories already exist
PostPosted: Tue Mar 31, 2009 8:45 pm 
Newbie

Joined: Tue Mar 31, 2009 8:27 pm
Posts: 2
I am working on a project with a separated Domain Layer and Repository layer, and I want to introduce NHibernate into the Repository Layer. At the moment all the repository code is hand-coded.

I would prefer to introduce NHibernate gradually - i.e. map one domain entity at a time, and convert the repository for that entity to use NHibernate.

However one of the domain entities I want to map: Account has a many to one relationship with one I don't want to map yet as it is very complex - Dealer. I would like to be able to load the Account using NHibernate, which will somehow load the associated Dealer using the existing repositories.

A nice to have is to be able to do an HQL search for Accounts like this:
"from Account where Account.Dealer.Id =:dealerId"

I have come up with several possibilities
    Create an IInterceptor and override GetEntity. However I'm not sure if this method was intended for this purpose.
    Create an IPropertyAccessor which goes to get the Dealer from the old repositories when setting the Dealer property on the Account. I don't this is was an intended use of IPropertyAccessor.
    Create an IUserType

I don't think any of these would allow the search to be done in the way described above.

Any suggestions as to the best way foward?

Thanks for your help.


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.