-->
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: Need help with mapping pre-existing database
PostPosted: Thu Sep 22, 2011 12:43 pm 
Newbie

Joined: Thu Sep 22, 2011 12:28 pm
Posts: 1
I'm relatively new to nHibernate but I've been able to figure out most of the basic mappings for our database.

I'm having trouble figuring out the mapping for this scenario:

Tables:
WebSessions
  • SessionId
  • WebServerSessionId

Carts
  • CartId
  • CartTypeId
  • SessionId

PurchaseItems
  • CartId
  • ProductId

RFQItems
  • CartId
  • ProductId

I know this is not a good design, but at this point, changing it is not an option. A websession has a one-to-many (in reality just one-to-two). Each session has a purchase cart and an rfq cart. Depending on the carttype (purchase,rfq), the cart joins to the PurchaseItems or RFQItems table.

If I wanted to have 2 one-to-one relationships, WebSession-to-Cart (purchase) and WebSession-to-Cart (rfq), is it possible to map this out?

I've thought of using a composite-id for the carts table, basically CartId and CartTypeId but I haven't found many good examples on that approach. Any help is appreciated!


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.