Thanks Thomas and Levi for your suggestions.  I'll answer you together... .

Levi - I'm not really looking for a JPA solution. In fact, if the approach of having no implicit initialization and the boolean argument constructor fully satisfies the JPA side... the issue that remains is on the Stripes Action Bean population side where by no implicit initialization is a problem.

Thomas - inheritance could work but it amounts to a lot of skeletal concrete subclasses... also the initialization is outside the class itself and although not a problem in itself as you could set attributes to be protected or simply accept calling setters on parent attributes I think there is a more elegant approach.

Before you both replied I had an idea which I am going to try out and come back and explain... .

Thanks Everyone.  Cheers,

--Nikolaos



Levi Hoogenberg wrote:
You could probably hook into Stripes' population strategy (and set new objects' /created/ property), but it sounds like you would much rather like a JPA solution (some kind of interceptor).

Thomas Menke wrote:
Nikolaos Giannopoulos wrote:
Hi,


Unfortunately we can't have the same zero argument constructor coded 2
different ways...

Yes, you can: If you derive from your class
class UserInitialized extends User
{
  public UserInitialized() { super(); /* Do some initialization */}
}
That might be an option depending on your requirements. Just need to use
the UserInitialized class in your jsp's.

Or you could have a a bean that does the initialization:
class UserInitializer
{
  User getInitializedUser() {User u = new User(); u.setFoo("bar");
return u; }
}

How do you load your user bean in the first place? If you use a getter
method of an action bean you could to the initialization in that getter
method.

--Nikolaos

Yannik


------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
Stripes-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-users

Reply via email to