Sorry... try:
class Foo extends LongKeyedMapper[Foo] with IdPK {
def getBazes = {
Baz.findAll(In(Baz.barid, Bar.id, By(Bar.fooid, this)))
}
}
object Foo extends Foo with LongKeyedMetaMapper[Foo]
class Bar extends LongKeyedMapper[Bar] with IdPK {
object fooid extends MappedLongForeignKey(this, Foo)
}
class Baz extends LongKeyedMapper[Baz] with IdPK {
object barid extends MappedLongForeignKey(this, Bar)
}
object Baz extends Baz with LongKeyedMetaMapper[Baz]
object Bar extends Bar with LongKeyedMetaMapper[Bar]
On Thu, Aug 13, 2009 at 1:48 PM, harryh <[email protected]> wrote:
>
> Foo = Venue, Bar = VenueAlias, Baz = Checkin
>
> lazy val checkins = Checkin.findAll(In.fk(Checkin.aliasid, By
> (VenueAlias.venueid, this.id)))
>
> confusing error message on compile:
>
> found : com.harryh.model.Checkin.aliasid.type (with underlying type
> object com.harryh.model.Checkin.aliasid)
> required: net.liftweb.mapper.MappedForeignKey
> [?,?,com.harryh.model.Checkin]
> Note that implicit conversions are not applicable because they are
> ambiguous:
> both method mapToType in object MappedField of type [T,A <:
> net.liftweb.mapper.Mapper[A]](net.liftweb.mapper.MappedField[T,A])T
> and method mapToType in object MappedField of type [T,A <:
> net.liftweb.mapper.Mapper[A]](net.liftweb.mapper.MappedField[T,A])T
> are possible conversion functions from
> com.harryh.model.Checkin.aliasid.type to
> net.liftweb.mapper.MappedForeignKey[?,?,com.harryh.model.Checkin]
> lazy val checkins = Checkin.findAll(In.fk(Checkin.aliasid, By
> (VenueAlias.venueid, this.id)))
>
>
> On Aug 13, 4:20 pm, David Pollak <[email protected]>
> wrote:
> > On Thu, Aug 13, 2009 at 12:41 PM, harryh <[email protected]> wrote:
> >
> > > I have 3 classes like so
> >
> > > class Foo extends LongKeyedMapper[Foo] with IdPK
> > > def getBazes = {
> > > Baz.findAll(...)
> > > }
> > > }
> >
> > Baz.findAll(In.fk(Baz.barid, By(Bar.fooid, this.id)))
> >
> >
> >
> >
> >
> > > class Bar extends LongKeyedMapper[Bar] with IdPK
> > > object fooid extends MappedLongForeignKey(this, Foo)
> > > }
> >
> > > class Baz extends LongKeyedMapper[Baz] with IdPK
> > > object barid extends MappedLongForeignKey(this, Bar)
> > > }
> >
> > > How do I write Baz.findAll(...) so it will give me all the Bazes that
> > > point to any Bars that point to the Foo. In SQL I would write
> > > something like this:
> >
> > > SELECT * FROM bazzes WHERE bazzes.barid = bars.id AND bars.fooid =
> > > 111; (where 111 is foo.id)
> >
> > > I feel like I should be using ByRef here? But it's not clear to me
> > > how to do it.
> >
> > > -harryh
> >
> > --
> > 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
>
> >
>
--
Lift, the simply functional web framework http://liftweb.net
Beginning Scala http://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
-~----------~----~----~----~------~----~------~--~---