isis-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeremy Gurr <>
Subject RE: NullPointerException when trying to persist a domain entity
Date Tue, 10 Sep 2013 19:06:37 GMT
Yeah, using newTransientInstance to obtain the entity vs. newing one up manually worked. Thanks.

Automatic recovery would be nice to make it easier for newbies to get up to speed with the
framework. At a minimum, the javadoc for the persist method should indicate that you can't
just persist any data entity, but that the entity must be obtained from the newTransientInstance

From: Dan Haywood []
Sent: Tuesday, September 10, 2013 11:51 AM
To: users
Subject: Re: NullPointerException when trying to persist a domain entity

How did you instantiate the transient object?  Did you just new it up, or
did you use container.newTransientInstance()?

I'm *hoping* the former.  The right thing to do is the latter.

If the above doesn't sort it out, then could you restate the problem but
using some different class names.  I got a bit confused with your
description, which class is the persistable entity (cf Customer), which
class is the domain service (cf CustomerRepo).

I agree that we should improve the error messages here.  We might even try
to automatically recover from the situation (by creating the adapter lazily
if not present) if we are passed a pojo that was created "outside" of the
container.  Off the top of my head, I can't see why that won't work (but I
might be forgetting something).


View raw message