Hello again,
I took a look at sessionfactory & serialization and found an interesting
thing.
SessionFactory is serializable but only it's name and uuid is
serialized(maybe some other minor stuff).
SessionFactory implements IObjectReference(which I didn't know previously).
After serialization takes place, the method "GetRealObject" is called to get
the real object.
NH executes the following in that method:
public object GetRealObject(StreamingContext context)
{
ISessionFactory result =
SessionFactoryObjectFactory.GetInstance(uuid);
if (result == null)
{
result = SessionFactoryObjectFactory.GetNamedInstance(name);
if (result == null)
throw new NullReferenceException("Could not find a
SessionFactory named " + name + " or identified by uuid " + uuid);
}
return result;
}
if sesisonFactory is deserialized into a different app domain, then it
checks if that appdomain has the factory with *name*, if deserialized into
same appdomain, then it is taken from the objectSessionFactory.
In our case, this approach won't work.
What do you think I should do? Just make session factory fully serializable?
Then what's the purpose of SessionFactoryObjectFactory? A custom serializer?
Tuna Toksöz
http://tunatoksoz.com
http://twitter.com/tehlike
Typos included to enhance the readers attention!
On Fri, Feb 6, 2009 at 12:43 AM, Fabio Maulo <[email protected]> wrote:
> What is needed is the SessionFactory serialization.The Conf should have a
> method to upLoad a serialized sessionFactory and you can use this method
> instead call BuildSessionFactory.
>
> 2009/2/5 Tuna Toksoz <[email protected]>
>
>> So it comes back to "serializing Configuration" idea? as in ram operations
>> are way cheaper than xml validation.
>>
>>
>> Tuna Toksöz
>> http://tunatoksoz.com
>> http://twitter.com/tehlike
>>
>> Typos included to enhance the readers attention!
>>
>>
>>
>> On Fri, Feb 6, 2009 at 12:31 AM, Fabio Maulo <[email protected]>wrote:
>>
>>> The BuildSessionFactory is the "in-ram compilation" of all mappings
>>> and persistence stuff.
>>> Serializing the sessionFactory and saving it to your hard-drive is
>>> equivalent to create an "EXE" of the persistence stuff.
>>>
>>
>>
>
>
> --
> Fabio Maulo
>