-->
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: Preprocessing when insert/retrieve from DB
PostPosted: Fri May 25, 2007 6:57 am 
Newbie

Joined: Fri May 25, 2007 6:34 am
Posts: 2
Hi guys,

I have a small project and I need your help with NHibernate, I read the manual many times but I didn't find a solution...or at least I didn't manage to find an elegant one.

I've a web service I can't modify to retrieve and store records from a remote location.
I have to first map the remote DB locally and after a separate software will create new records in the local DB that I have to push back with the webservice.
In other words I have to keep the local and the live DBs in synch with the possibility to create/update/delete records on both sides.

The problem is more or less the following:

Web service objects are linked to each other, but instead of an object having a reference of another object it has a reference to a RecordRef object. Using the RecordRef object it's then possible to retrieve the linked object.

For example:

Class Employee
{
public string name
public RecordRef employeeStatus
public RecordRef employeeDepartment
}

Class RecordRef
{
public int id
public string linkedTableName (this will be 'EmployeeStatus' or 'EmployeeDepartment' in the example)
}

Class EmployeeStatus
{
public int employeeStatusId
public string status
}

Class EmployeeDepartment
{
public int employeeDepartmentId
public string department
}

In practice instead of linking the Employee directly to EmployeeStatus and EmployeeDepartment they link it to the RecordRef.

I don't think it's complex to map all this to a DB using NHibernate (more or less I managed to do it).
But the problem is that I want to 'hide' the further RecordRef step in the DB. I would like to link Employee directly to EmployeeStatus in the DB (so that the other software can easily create records) using both the 'id' and the 'linkedTableName' and when I retrieve one of them back I would like to create a RecordRef on the fly (so I can push the object to the web service).

I thought to use my own "Access Strategy" or event "Interceptor" but maybe there is a simpler way.

Thanks for your suggestions,
Raffaele


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.