-->
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: Loading for updates with more than one key field
PostPosted: Tue Jun 07, 2005 1:05 pm 
Hi

I originally was attempting to load objects to update them by creating an object representation of my base table and adding the key information required to pull back an object (my table has and index of 2 fields). I have this working in one project like so:

// Create Table object
tableObject to = new tableObject;
to.Key1 = value1;
to.Key2 = value2;

session.Load(typeof(tableObject), to);

to.Field = newValue1;

session.Flush() ;

The code appears to be working correctly and has for the past 4 months. However I cannot replicate this kind of functionality in my most recent attempts. I am getting an error when I try to place an object in the .Load to represent a complex key. It works if I insert a single value but not an object like:

session.Load(typeof(tableObject), keyValue);

to.Field = newValue1;

session.Flush() ;

The documentation looks this way as well. What does one do with a multi-columned key on the table if you cannot submit an object without getting
a

Exception: System.InvalidCastException
Message: Object must implement IConvertible.

message? I am currently testing with version 7.

Thanks.


Top
  
 
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.