Hi epitka,
If you re-load the object from the session, you'll get the proxy back (and
it won't hit the database). In the past I've added a 'This' property on my
domain class to do this:
private Pepe This
{
get
{
return Session.Load<Pepe>(typeof(Pepe), Id);
}
}
http://forum.hibernate.org/viewtopic.php?t=982610&highlight=
Is that what you are after?
Cheers,
Richard
--------------------------------------------------
From: "epitka" <[EMAIL PROTECTED]>
Sent: Saturday, November 22, 2008 6:51 PM
To: "nhusers" <[email protected]>
Subject: [nhusers] Re: How to get a reference to proxy if I have reference
to ...
>
> I have a "pepe' and I know it is not a proxy, but there is a proxy
> created for "pepe", and I need that proxy that was created for pepe.
> In the DafaultCollectionInitializeEventListener, I have a non-proxy
> through collection.owner, now I need to get the proxy that was already
> created for this object.
>
>
>
> On Nov 22, 11:41 am, "Fabio Maulo" <[EMAIL PROTECTED]> wrote:
>> I don't understand what you are looking for.You have an object instance
>> named "pepe".
>> To know if pepe is a proxy: pepe as INHibernateProxy and etc. etc.
>> If pepe is a proxy you have the ILazyInitializer to know various things
>> including the underlining instance the proxy are proxying.
>> /// <summary>
>> /// Return the Underlying Persistent Object, initializing if necessary.
>> /// </summary>
>> /// <returns>The Persistent Object this proxy is Proxying.</returns>
>> object GetImplementation();
>>
>> /// <summary>
>> /// Return the Underlying Persistent Object in a given <see
>> cref="ISession"/>, or null.
>> /// </summary>
>> /// <param name="s">The Session to get the object from.</param>
>> /// <returns>The Persistent Object this proxy is Proxying, or <see
>> langword="null" />.</returns>
>> object GetImplementation(ISessionImplementor s);
>>
>> 2008/11/22 epitka <[EMAIL PROTECTED]>
>>
>>
>>
>>
>>
>> > Well, I am leading a project of generating complete MVC type web
>> > application with POCO domain layer and NH and ORM from domain
>> > developed using Intelliun's VE Enterprise (www.intelliun.com). One of
>> > the features of this platform is auto synchronizing of bidirectional
>> > relationships.
>> > Anyway, I looked at the Abstract, Basic and Casle initializer, yet I
>> > don't see a way to get proxy from proxied class, only to get
>> > underlying persistent object from the proxy. Am I missing something?
>>
>> > On Nov 22, 10:57 am, "Fabio Maulo" <[EMAIL PROTECTED]> wrote:
>> > > 2008/11/22 Ken Egozi <[EMAIL PROTECTED]>
>>
>> > > > I'd think that ReferenceEquels is not appropriate here.
>> > > > 'equality' in terms of persisted objects, is either through the PK
>> > > > (for
>> > > > entities) or the combination of all properties (for Value Objects).
>> > > > It's perfectly allright imo for a DAL of any kind to represent the
>> > exact
>> > > > same DB row in two actual in-memory objects.
>>
>> > > POID only where available, or "natural id" where the POID is not
>> > available
>> > > is acceptable too ;)
>> > > --
>> > > Fabio Maulo
>>
>> --
>> Fabio Maulo
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"nhusers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/nhusers?hl=en
-~----------~----~----~----~------~----~------~--~---