Seam @Factory in abstract base class?

Posted by Shadowman on Stack Overflow See other posts from Stack Overflow or by Shadowman
Published on 2010-06-17T17:19:09Z Indexed on 2010/06/17 17:23 UTC
Read the original article Hit count: 262

I've got a series of web actions I'm implementing in Seam to perform create, read, update, etc. operations. For my read/update/delete actions, I'd like to have individual action classes that all extend an abstract base class. I'd like to put the @Factory method in the abstract base class to retrieve the item that is to be acted upon. For example, I have this as the base class:

public abstract class BaseAction {

   @In(required=false)@Out(required=false)
   private MyItem item=null;

   public MyItem getItem(){...}

   public void setItem(...){...}

   @Factory("item")
   public void initItem(){...}
}

My subclasses would extend BaseAction, so that I don't have to repeat the logic to load the item that is to be viewed, deleted, updated, etc. However, when I start my application, Seam throws errors saying I have declared multiple @Factory's for the same object.

Is there any way around this? Is there any way to provide the @Factory in the base class without encoutnering these errors?

© Stack Overflow or respective owner

Related posts about java

Related posts about inheritance