Seam @Factory in abstract base class?
- by Shadowman
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?