-->
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.  [ 2 posts ] 
Author Message
 Post subject: Mapping Surrogate Primary Key for Dictionary/Map
PostPosted: Mon Aug 03, 2009 8:06 am 
Beginner
Beginner

Joined: Wed Oct 18, 2006 4:41 am
Posts: 20
Location: West Yorkshire, UK
Hi there,

I have a simple Dictionary<string, string> that is mapped successfully as follows:

Code:
    <map name="Properties" table="EntityProperty" >
      <key column="EntityID"/>       
      <index column="Title" type="System.String"/>     
      <element column="Value" type="System.String"/>     
    </map>


Everything works fine, however I want to export the schema which obviously doesn't include the non-mentioned surrogate primary key; EntityPropertyID. How can I include this in the mapping, much as I would for an idbag?

Many thanks in advance, CArl


Top
 Profile  
 
 Post subject: Re: Mapping Surrogate Primary Key for Dictionary/Map
PostPosted: Mon Aug 03, 2009 10:25 am 
Beginner
Beginner

Joined: Wed Oct 18, 2006 4:41 am
Posts: 20
Location: West Yorkshire, UK
Sorry, there's an additional question here relating to this: I have added cascase="all-delete-orphan" to this mapping. When I add elements to a new Entity and persist that entity, the properties do not get persisted. Can anybody please explain what I am doing wrong? I am using NHibernate 2.1.

Thanks, Carl


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

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.