In my bag of knowledge :) (google)

Viktor,
Rogue Software Architect

20 mar 2009 kl. 20.24 "Charles F. Munat" <[email protected]> skrev:

>
> Ooooh. That's really good to know. Where did you find that?
>
> Chas.
>
> Viktor Klang wrote:
>> If you need the Class:
>>
>> org.
>> hibernate.
>> proxy.HibernateProxyHelper.getClassWithoutInitializingProxy(obj)
>>
>> On Fri, Mar 20, 2009 at 12:08 PM, Timothy Perrett
>> <[email protected]> wrote:
>>
>>    Chas,
>>
>>    If you want the object to tell you what it is can you not use some
>>    form of reflection?
>>
>>    Tim
>>
>>
>>    On 20/03/2009 11:03, "Viktor Klang" <[email protected]
>>    <http://[email protected]>> wrote:
>>
>>
>>
>>        On Fri, Mar 20, 2009 at 11:43 AM, Charles F. Munat
>>        <[email protected] <http://[email protected]>> wrote:
>>
>>
>>            Not really. What I want to do is have the object tell me
>>            what it is.
>>            Unless I'm really misunderstanding isInstanceOf, I have to
>>            iterate
>>            through all the possibilities. Plus, my brain is probably
>>            just fried,
>>            but I'm not seeing how to use it in a match, so I'm having
>>            to run
>>            through a bunch of if statements. I know there's a better
>>            way. Just
>>            can't see it at 3:45 AM.
>>
>>
>>        But you wrote: ". But then as I'm looping through them, I want
>>        to find out
>>        what type of event they really are."
>>
>>        so when you're looping through them, if you're doing
>>        pattern-matching you could probably just:
>>
>>        case x : MySubEvent => blah(x)
>>        case y : MyOtherSubEvent => blugh(y)
>>        case _ => ohSnap()!
>>
>>
>>
>>
>>
>>            Chas.
>>
>>            Viktor Klang wrote:
>>>
>>>
>>> On Fri, Mar 20, 2009 at 9:37 AM, Charles F. Munat
>>            <[email protected] <http://[email protected]>
>>> <mailto:[email protected]> <mailto:[email protected]%3e>> wrote:
>>>
>>>
>>>     I have a BaseEvent object from which various other
>>            events (e.g. Seminar)
>>>     inherit. I want to pull them all out in a query, so
>>            they come out as
>>>     BaseEvents. But then as I'm looping through them, I
>>            want to find out
>>>     what type of event they really are. There is an
>>            "event_type" column in
>>>     the database, but I don't know how to get at that.
>>>
>>>
>>> Don't fancy "isInstanceOf"?
>>>
>>>
>>>
>>>
>>>     Anyone know offhand how to get the class of the
>>            objects? This is in Lift
>>>     with JPA/Hibernate.
>>>
>>>     Thanks,
>>>     Chas.
>>>
>>>
>>>
>>>
>>>
>>> --
>>> Viktor Klang
>>> Senior Systems Analyst
>>>
>>>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> --  
>> Viktor Klang
>> Senior Systems Analyst
>>
>>>
>
> >

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Lift" 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/liftweb?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to