-->
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: Mapping several tables to a single object?
PostPosted: Thu Dec 06, 2007 9:33 am 
Newbie

Joined: Thu Dec 06, 2007 9:08 am
Posts: 2
Hi all,

I've been battling with this issue for days now, and thought I'd post a message here to see if anyone else has ever come into contact with this before and might know a few useful tips.

Basically, I want to be able to map a single object to several tables over multiple databases.

At the moment, I'm creating a new session factory for each Configuration object I've got (one for each configuration file and it's mapping file that's passed in via e.g. dependency injection). This approach works fine, and I've wrapped the sessions CRUD operations in a a transaction scope so they all enlist in the DTC. This means I can create a new object and save it, and it gets saved to all tables I've specified.

The real headscratcher here is what to do about the Id. As I use surrogate keys, I'm having a real hard time figuring out how to squeeze all the primary keys (and foreign keys) from my tables into my one object. I've tried using <composite-id>, <id-bag> and my own IUserType type but to no avail. I'd love it if there was a way to tell nHibernate to put the id in some sort of Dictionary and use either a specified key or the sessionId to set and get it.

I suppose one could use a global key (such as a guid) but I'd rather not for now, as the additional tables are mainly legacy tables that I wouldn't like to fiddle too much with.

Has anyone ever encountered this kind of scenario before?? Sorry for the long post.

Cheers,
Fred


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.