2009/5/8 [email protected] <[email protected]>

>
> 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 <[email protected]> wrote:
> > On Tue, May 5, 2009 at 6:03 PM, [email protected] <
> >
> > [email protected]> 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 [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
-~----------~----~----~----~------~----~------~--~---

Reply via email to