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: composite-element always inserts when it should do update
PostPosted: Mon Feb 09, 2009 9:17 pm 
Newbie

Joined: Mon Aug 22, 2005 7:11 pm
Posts: 13
I have a composite-element defined as such:
Code:
            HasMany<TrainingActivityCost>(x => x.ActivityCosts)
                .WithTableName("TrainingActivityCosts")
                .WithKeyColumn("TrainingActivityID")
            .Cascade.All()
                .Component(ac =>
                {

                   ac.Map(a => a.ID).FormulaIs("TrainingActivityCostID");
                    ac.Map(a => a.Comments, "Comments");
                    ac.Map(a => a.EntryDate, "EntryDate");
                    ac.Map(a => a.Number, "Number");
                    ac.Map(a => a.Actual, "Actual");
                    ac.Map(a => a.Estimate, "Estimate");

                    ac.References(a => a.CostType, "TrainingCostTypeID").SetAttribute("not-null", "true");
                })
                .AsBag();


TrainingActivityCostID is an identity column.

I fetch an activty cost as such:

Code:
var tc = activity.ActivityCosts.First(c => c.ID == Int32.Parse(TrainingActivityCostID));


I then modify a property or two ... do SaveOrUpdate() ... and it always does an insert of a new ActivityCost instead of updating the existing.

Any ideas what I'm doing wrong?

Thanks - wg


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.