ok, here is the code:
public interface Bean2 { public List<TaskInstance> searchTasks(TaskSearchEvent event, String column, boolean ascending, int firstRow, int pageSize);
public class BeanFactory{ public static Bean2 getBean(TaskSearchEvent searchEvent) { if( searchEvent.getTaskAssignment() == TaskAssignment.ASSIGNED_TO_ACTOR ) { // assigned tasks return (Bean2)JNDIUtil.lookup(Bean2Impl.JNDI_NAME_LOCAL); } else .. } }
@Stateless public class Bean2Impl extends AbstractBean implements Bean2ImplLocal{ public static final String JNDI_NAME_LOCAL = "blabla"; @Override protected GenericEntityQuery createInitialEntityQuery(String selectSegment, AssignmentValues actors) { ... } }
public abstract class AbstractBean implements Bean2 { protected abstract GenericEntityQuery createInitialEntityQuery(String selectSegment, AssignmentValues actors); public List<TaskInstance> searchTasks(TaskSearchEvent event, String column, boolean ascending, int firstRow, int pageSize) { if( event != null ) { GenericEntityQuery q = createInitialEntityQuery("select distinct ti from", actors); Query query = hibernateSession().createQuery(q.getQueryString()); setParametersToQuery(query, q); query.setFirstResult(firstRow); query.setMaxResults(pageSize); return query.list(); } else { return Collections.emptyList(); } }
Nothing obviously wrong with this code, you don't have @Clustered on Bean2, but that shouldn't matter.
So that leaves problems with your cluster configuration. You should really ask on the JBoss AS forums about that.