On Fri, Jul 3, 2009 at 8:08 AM, Ken T.<
ktectropy@...> wrote:
> I've got an action in a controller that looks like this:
>
> def create = {
> def instance = new MyClass()
> instance.properties = params
> def subject = SecurityUtils.getSubject()
> instance.author = User.findByUsername(subject.getPrinciple())
> return ['instance':instance]
> }
>
> The class, MyClass, is a domain class. Nothing particularly special
> here. It has a few constraints and four fields.
>
> The problem I'm having is that right after assignment the variable
> instance is null. Shouldn't new always returns something here?
>
> Thanks.
>
Something is not right there. new can't return null.
Are you sure it is null or are you basing that on the result of
calling toString() and seeing the word "null" in the result (like
"MyClass : null")?
jb
--
Jeff Brown
SpringSource
http://www.springsource.com/Autism Strikes 1 in 166
Find The Cause ~ Find The Cure
http://www.autismspeaks.org/---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email