git clone git://github.com/rstradling/DDLtoLiftORM.git is the location of the git code.
http://github.com/rstradling/DDLtoLiftORM is the web address I hope this is helpful to others. On Aug 27, 3:13 pm, rstradling <[email protected]> wrote: > Thanks for the answers everyone. What David hit upon about wanting > objects to be subclassible is the conclusion I came to that would > work..if it existed. I was hoping there was a way. :(. Well, I guess > Naftoli has provided a possible solution but seems more involved than > I have the experience for. > > I will resort to putting the stuff on the generated classes and let > merge tools do the rest. > > Regarding sharing the code....I should be more specific in that it > parses ddl. To be honest, I hope you all are not hoping for > much....but I will get it up on github and when I do will reply to > this thread with the location. > > On Aug 27, 1:35 pm, David Pollak <[email protected]> > wrote: > > > On Thu, Aug 27, 2009 at 10:26 AM, rstradling <[email protected]>wrote: > > > > With a parser combinator I wrote to parse .sql and it outputs scala > > > orm files. > > > Care to share? That'd be a pretty darned useful utility! > > > > 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 :).. > > > So... the problem is that objects in Scala are not subclassible. What does > > this mean? For example: > > > trait Foo { > > object bar extends AnyRef > > > } > > > trait MyFoo extends Foo { > > override object bar { > > def cantDoIt = "sigh" > > } > > > } > > > Back in the Scala 2.5 days, there was some talk about allowing this to > > happen, but it never did. So, unfortunately, I can't think of a way for > > your sql generator to create a superclass that could be subclassed and have > > the effect that you want. > > > Sorry/ > > > > On Aug 27, 1:09 pm, Naftoli Gugenheim <[email protected]> wrote: > > > > 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? > > > -- > > Lift, the simply functional web frameworkhttp://liftweb.net > > Beginning Scalahttp://www.apress.com/book/view/1430219890 > > Follow me:http://twitter.com/dpp > > Git some:http://github.com/dpp --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
