How do you auto-generate them?
On Thu, Aug 27, 2009 at 1:03 PM, rstradling <[email protected]> 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 [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
-~----------~----~----~----~------~----~------~--~---