-->
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: Serialization of custom objects
PostPosted: Fri Nov 25, 2005 8:06 am 
Hi there

I'm just having a first look at NHibernate which looks really promising :)

However, I'm not sure whether I can make it fit my rather complex model. My main concern ist the serialization of such a class:

Code:
public class BusinessObject
{
  string key;

  DateTime lastUpdate;

  object currentValue;
}


The field currentValue can hold arbitrary objects. All of them have in common that they are marked as Serializable, but two instances of BusinessObject can have completely different object (e.g. one stores a Color value, another one a Size structcure and a third one a string or numeric value).

I assume the corresponding column in the table would either be binary to get binary serialization or text (serialized value with base64 encoding).

Can NHibernate handle proper storage and retrieval of such objects?

Thanks for your advice
Philipp


Top
  
 
 Post subject:
PostPosted: Fri Nov 25, 2005 9:52 am 
Regular
Regular

Joined: Fri Jun 11, 2004 6:27 am
Posts: 81
Location: Yaroslavl, Russia
Create custom type which will serialize your objects on save and deserialize on load. Specify this type in the mapping document. Examples of such custom types you can find in NHibernate.Nullables library.

_________________
Best,
Andrew Mayorov // BYTE-force


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.