[Lift] Re: JPA inheritance

2009-03-20 Thread Charles F. Munat

You must know how to sweet talk Google. It's rarely that forthcoming 
with me. I'm going to try to figure out how to increase the heap size 
and see if that works. But is there some way that a compiler can get 
into an infinite loop?

Chas.

Viktor Klang wrote:
> In my bag of knowledge :) (google)
> 
> Viktor,
> Rogue Software Architect
> 
> 20 mar 2009 kl. 20.24 "Charles F. Munat"  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
>>>  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" >>> wrote:
>>>
>>>
>>>
>>>On Fri, Mar 20, 2009 at 11:43 AM, Charles F. Munat
>>>http://c...@munat.com>> 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
>>>http://c...@munat.com>
  > 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 liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: JPA inheritance

2009-03-20 Thread Viktor Klang

In my bag of knowledge :) (google)

Viktor,
Rogue Software Architect

20 mar 2009 kl. 20.24 "Charles F. Munat"  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
>>  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" >> wrote:
>>
>>
>>
>>On Fri, Mar 20, 2009 at 11:43 AM, Charles F. Munat
>>http://c...@munat.com>> 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
>>http://c...@munat.com>
>>>  > 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 liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: JPA inheritance

2009-03-20 Thread Charles F. Munat

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 
>  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"  > wrote:
> 
> 
> 
> On Fri, Mar 20, 2009 at 11:43 AM, Charles F. Munat
> http://c...@munat.com>> 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
> http://c...@munat.com>
> >   > 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 liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: JPA inheritance... now it won't compile

2009-03-20 Thread Viktor Klang
Chas,

I have no clue since I don't know what your code looks like.
But just increase the heap size? Maybe you just hit the roof?

Cheers,
Viktor

On Fri, Mar 20, 2009 at 12:55 PM, Charles F. Munat  wrote:

>
> Viktor, I guess you didn't see my other "never mind" email as it went
> out about six minutes before you sent this. I arrived at the same
> conclusion. Duh.
>
> But now I'm running out of heap space when I try to compile. I shut
> everything down, rebooted. Still breaks. I pulled out all the code I'd
> just added. Still breaks. Tried another app -- that works no problem.
>
> What could I have done to make it run out of heap space on compile?
> Anyone else run into this? Nothing in the warnings seems to be of any
> use at all.
>
> Chas.
>
> [WARNING] Exception in thread "main" java.lang.OutOfMemoryError: Java
> heap space
> [WARNING]   at scala.StringBuilder.(StringBuilder.scala:33)
> [WARNING]   at scala.StringBuilder.(StringBuilder.scala:41)
> [WARNING]   at
> scala.tools.nsc.symtab.Names$Name.decode(Names.scala:390)
> [WARNING]   at
> scala.tools.nsc.symtab.Symbols$Symbol.nameString(Symbols.scala:1224)
> [WARNING]   at
> scala.tools.nsc.symtab.Symbols$Symbol.toString(Symbols.scala:1261)
> [WARNING]   at
> scala.tools.nsc.backend.icode.Members$Local.toString(Members.scala:305)
> [WARNING]   at java.lang.String.valueOf(String.java:2615)
> [WARNING]   at scala.StringBuilder.append(StringBuilder.scala:234)
> [WARNING]   at
>
> scala.tools.nsc.backend.jvm.GenJVM$BytecodeGenerator.indexOf(GenJVM.scala:1526)
> [WARNING]   at
>
> scala.tools.nsc.backend.jvm.GenJVM$BytecodeGenerator$$anonfun$genBlock$1$1.apply(GenJVM.scala:914)
> [WARNING]   at
>
> scala.tools.nsc.backend.jvm.GenJVM$BytecodeGenerator$$anonfun$genBlock$1$1.apply(GenJVM.scala:866)
> [WARNING]   at scala.Iterator$class.foreach(Iterator.scala:414)
> [WARNING]   at
> scala.runtime.BoxedArray$AnyIterator.foreach(BoxedArray.scala:45)
> [WARNING]   at scala.Iterable$class.foreach(Iterable.scala:256)
> [WARNING]   at scala.runtime.BoxedArray.foreach(BoxedArray.scala:24)
> [WARNING]   at
>
> scala.tools.nsc.backend.icode.BasicBlocks$BasicBlock.foreach(BasicBlocks.scala:130)
> [WARNING]   at
>
> scala.tools.nsc.backend.jvm.GenJVM$BytecodeGenerator.genBlock$1(GenJVM.scala:866)
> [WARNING]   at
>
> scala.tools.nsc.backend.jvm.GenJVM$BytecodeGenerator.genBlocks$1(GenJVM.scala:789)
> [WARNING]   at
>
> scala.tools.nsc.backend.jvm.GenJVM$BytecodeGenerator.genCode(GenJVM.scala:1413)
> [WARNING]   at
>
> scala.tools.nsc.backend.jvm.GenJVM$BytecodeGenerator.genMethod(GenJVM.scala:592)
> [WARNING]   at
>
> scala.tools.nsc.backend.jvm.GenJVM$BytecodeGenerator$$anonfun$genClass$4.apply(GenJVM.scala:216)
> [WARNING]   at
>
> scala.tools.nsc.backend.jvm.GenJVM$BytecodeGenerator$$anonfun$genClass$4.apply(GenJVM.scala:216)
> [WARNING]   at scala.List.foreach(List.scala:834)
> [WARNING]   at
>
> scala.tools.nsc.backend.jvm.GenJVM$BytecodeGenerator.genClass(GenJVM.scala:216)
> [WARNING]   at
>
> scala.tools.nsc.backend.jvm.GenJVM$JvmPhase$$anonfun$run$2.apply(GenJVM.scala:55)
> [WARNING]   at
>
> scala.tools.nsc.backend.jvm.GenJVM$JvmPhase$$anonfun$run$2.apply(GenJVM.scala:55)
> [WARNING]   at scala.Iterator$class.foreach(Iterator.scala:414)
> [WARNING]   at scala.collection.Map$$anon$6.foreach(Map.scala:123)
> [WARNING]   at
> scala.tools.nsc.backend.jvm.GenJVM$JvmPhase.run(GenJVM.scala:55)
> [WARNING]   at
> scala.tools.nsc.Global$Run.compileSources(Global.scala:574)
> [WARNING]   at scala.tools.nsc.Global$Run.compile(Global.scala:667)
> [WARNING]   at scala.tools.nsc.Main$.process(Main.scala:73)
> [INFO]
> 
> [ERROR] BUILD FAILURE
>
> Viktor Klang wrote:
> >
> >
> > On Fri, Mar 20, 2009 at 11:43 AM, Charles F. Munat  > > 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  > 
> >  > >> wrote:
> >  >
> >  >
> >   

[Lift] Re: JPA inheritance

2009-03-20 Thread Viktor Klang
If you need the Class:

org.hibernate.proxy.HibernateProxyHelper.getClassWithoutInitializingProxy(obj)

On Fri, Mar 20, 2009 at 12:08 PM, Timothy Perrett
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"  wrote:
>
>
>
> On Fri, Mar 20, 2009 at 11:43 AM, Charles F. Munat  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  >  > 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 liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: JPA inheritance... now it won't compile

2009-03-20 Thread Charles F. Munat

Viktor, I guess you didn't see my other "never mind" email as it went 
out about six minutes before you sent this. I arrived at the same 
conclusion. Duh.

But now I'm running out of heap space when I try to compile. I shut 
everything down, rebooted. Still breaks. I pulled out all the code I'd 
just added. Still breaks. Tried another app -- that works no problem.

What could I have done to make it run out of heap space on compile? 
Anyone else run into this? Nothing in the warnings seems to be of any 
use at all.

Chas.

[WARNING] Exception in thread "main" java.lang.OutOfMemoryError: Java 
heap space
[WARNING]   at scala.StringBuilder.(StringBuilder.scala:33)
[WARNING]   at scala.StringBuilder.(StringBuilder.scala:41)
[WARNING]   at scala.tools.nsc.symtab.Names$Name.decode(Names.scala:390)
[WARNING]   at 
scala.tools.nsc.symtab.Symbols$Symbol.nameString(Symbols.scala:1224)
[WARNING]   at 
scala.tools.nsc.symtab.Symbols$Symbol.toString(Symbols.scala:1261)
[WARNING]   at 
scala.tools.nsc.backend.icode.Members$Local.toString(Members.scala:305)
[WARNING]   at java.lang.String.valueOf(String.java:2615)
[WARNING]   at scala.StringBuilder.append(StringBuilder.scala:234)
[WARNING]   at 
scala.tools.nsc.backend.jvm.GenJVM$BytecodeGenerator.indexOf(GenJVM.scala:1526)
[WARNING]   at 
scala.tools.nsc.backend.jvm.GenJVM$BytecodeGenerator$$anonfun$genBlock$1$1.apply(GenJVM.scala:914)
[WARNING]   at 
scala.tools.nsc.backend.jvm.GenJVM$BytecodeGenerator$$anonfun$genBlock$1$1.apply(GenJVM.scala:866)
[WARNING]   at scala.Iterator$class.foreach(Iterator.scala:414)
[WARNING]   at 
scala.runtime.BoxedArray$AnyIterator.foreach(BoxedArray.scala:45)
[WARNING]   at scala.Iterable$class.foreach(Iterable.scala:256)
[WARNING]   at scala.runtime.BoxedArray.foreach(BoxedArray.scala:24)
[WARNING]   at 
scala.tools.nsc.backend.icode.BasicBlocks$BasicBlock.foreach(BasicBlocks.scala:130)
[WARNING]   at 
scala.tools.nsc.backend.jvm.GenJVM$BytecodeGenerator.genBlock$1(GenJVM.scala:866)
[WARNING]   at 
scala.tools.nsc.backend.jvm.GenJVM$BytecodeGenerator.genBlocks$1(GenJVM.scala:789)
[WARNING]   at 
scala.tools.nsc.backend.jvm.GenJVM$BytecodeGenerator.genCode(GenJVM.scala:1413)
[WARNING]   at 
scala.tools.nsc.backend.jvm.GenJVM$BytecodeGenerator.genMethod(GenJVM.scala:592)
[WARNING]   at 
scala.tools.nsc.backend.jvm.GenJVM$BytecodeGenerator$$anonfun$genClass$4.apply(GenJVM.scala:216)
[WARNING]   at 
scala.tools.nsc.backend.jvm.GenJVM$BytecodeGenerator$$anonfun$genClass$4.apply(GenJVM.scala:216)
[WARNING]   at scala.List.foreach(List.scala:834)
[WARNING]   at 
scala.tools.nsc.backend.jvm.GenJVM$BytecodeGenerator.genClass(GenJVM.scala:216)
[WARNING]   at 
scala.tools.nsc.backend.jvm.GenJVM$JvmPhase$$anonfun$run$2.apply(GenJVM.scala:55)
[WARNING]   at 
scala.tools.nsc.backend.jvm.GenJVM$JvmPhase$$anonfun$run$2.apply(GenJVM.scala:55)
[WARNING]   at scala.Iterator$class.foreach(Iterator.scala:414)
[WARNING]   at scala.collection.Map$$anon$6.foreach(Map.scala:123)
[WARNING]   at 
scala.tools.nsc.backend.jvm.GenJVM$JvmPhase.run(GenJVM.scala:55)
[WARNING]   at 
scala.tools.nsc.Global$Run.compileSources(Global.scala:574)
[WARNING]   at scala.tools.nsc.Global$Run.compile(Global.scala:667)
[WARNING]   at scala.tools.nsc.Main$.process(Main.scala:73)
[INFO] 

[ERROR] BUILD FAILURE

Viktor Klang wrote:
> 
> 
> On Fri, Mar 20, 2009 at 11:43 AM, Charles F. Munat  > 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  
>  > >> 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 

[Lift] Re: JPA inheritance

2009-03-20 Thread Timothy Perrett
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"  wrote:

> 
> 
> On Fri, Mar 20, 2009 at 11:43 AM, Charles F. Munat  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 >> > > 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
>>> >
 > >
>> 
>> 
> 
> 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: JPA inheritance

2009-03-20 Thread Viktor Klang
On Fri, Mar 20, 2009 at 11:43 AM, Charles F. Munat  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  > > 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 liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: JPA inheritance... never mind

2009-03-20 Thread Charles F. Munat

OK, I really am tired...

How about this:

(b: BaseEvent) match {
   case b: Seminar => ...
   case b: Event => ...
   case _ => ...
}

Sigh...

Thanks anyway!

Chas.

Charles F. Munat 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.
> 
> Chas.
> 
> Viktor Klang wrote:
>>
>> On Fri, Mar 20, 2009 at 9:37 AM, Charles F. Munat > > 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
>>
> 
> > 

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: JPA inheritance

2009-03-20 Thread Charles F. Munat

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.

Chas.

Viktor Klang wrote:
> 
> 
> On Fri, Mar 20, 2009 at 9:37 AM, Charles F. Munat  > 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
> 
> > 

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: JPA inheritance

2009-03-20 Thread Viktor Klang
On Fri, Mar 20, 2009 at 9:37 AM, Charles F. Munat  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

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---