Naked Objects will automatically inject any
domain services into your domain objects, but to do this must know about
then when they are instantiated. But it also requires to know about them
so that it can track their persistence state. To do this, use the
DomainObjectContainer#newTransientInstance(Class)
method. Note that this also requires that your domain object has a
public
no-arg constructor.
Similarly, if you want to persist a domain object, use
DomainObjectContainer#persist()
.
If inheriting from AbstractDomainObject
,
then there are helper methods that delegate to the container for
you.