With a parser combinator I wrote to parse .sql and it outputs scala
orm files.  Please note it is very specific to my needs (i.e. only
works with certain grammars (INSERTS) but that particular grammar is
all I needed to process at the time) but is written in a way that
could be extended to the full grammar (at least that was my
intent :)..


On Aug 27, 1:09 pm, Naftoli Gugenheim <naftoli...@gmail.com> wrote:
> How do you auto-generate them?
>
> On Thu, Aug 27, 2009 at 1:03 PM, rstradling <ryanstradl...@gmail.com> wrote:
>
> > I am using Lift 1.0 with the Mapper ORM module from Lift. I am a
> > newbie to Scala and Lift.  I have auto-generated my ORM classes from
> > a .sql file.  Given that these classes are auto-generated I would
> > prefer not to edit them directly and provide additional functionality
> > via inheritance.
>
> > Say I have the following...
> > class StatGenerated extends LongKeyedMapper[StatGenerated] with IdPK {
> >   def getSingleton = StatGenerated
> >   object errors extends MappedLong(this)
> >   object hits extends MappedLong(this)
> >   object AB extends MappedLong(this)
> > }
>
> > object StatGenerated extends StatGenerated with LongKeyedMetaMapper
> > [StatGenerated] {
> >   override def fieldOrder = List(errors, hits)
> > }
>
> > class Statistics extends StatGenerated {
> >   def GetBattingAverage(id : Long) : float = {
> >                val stat = Stat.findByKey(id)
> >                stat.hits/stat.AB
> >   }
> > }
>
> > Now what I would like to do is work with the Statistics class as my
> > ORM object...
> > But I believe everything that is ORM related is actually of type
> > StatGenerated rather than Statistics.  i.e. findByKey will return me a
> > StatGenerated rather than a Statistics class.  Is there any clever way
> > around this that I am missing without either modifying the generated
> > class or duplicating code?

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to