2009/5/8 sailormoo...@gmail.com <sailormoo...@gmail.com>

>
> Thanks...
>
> Another question is, when I want to set the foreign key to null
> I use talk.actioner_id(null.asInstanceof[UserEntry])
>

As a general run, if you find yourself using null in Lift, you're doing
something wrong. :-)

Lift, and Scala more generally, uses Box or Option for anything that could
be nullable in Java or other languages.  For example:

talk.actioner_id(Empty) will do what you want.


>
> which results an exception, how to set a foreign key to null?
>
> Thanks
>
> On 5月7日, 上午1時18分, David Pollak <feeder.of.the.be...@gmail.com> wrote:
> > On Tue, May 5, 2009 at 6:03 PM, sailormoo...@gmail.com <
> >
> > sailormoo...@gmail.com> wrote:
> >
> > > Hello:
> >
> > >  I want to know how to check if a field is null.
> > > The code results in an error
> >
> > > if (talk.actioner_id.is != null)
> > > {}
> >
> > I'm figuring talk.actioner_id is a MappedLongForeignKey... correct?  If
> so,
> > use if (talk.acutioner_id.defined_?) { ... }
> >
> > Thanks,
> >
> > David
> >
> >
> >
> > > warning: comparing values of types Long and Null using `!=' will
> > > always yield true
> >
> > --
> > 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 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