Seems IntelliJ 14 not support AbstractFacade class in EJB

I am quite new in IntelliJ. I tried to migrate one Java Project from Netbeans 8 to IntelliJ 14. But I found IntelliJ has no a way to support in EJB (session bean) development.

Actually, as IntelliJ support EJB-3.2, Netbeans supports EJB-3.1. but seems there is no way to change very common such as:

package com.longz.ozssc.intellij.ejb;

import javax.ejb.Stateless;
import javax.interceptor.Interceptors;
import javax.persistence.EntityManager;
import java.util.List;

* Created by cidylong on 6/12/2014.

/*@Stateless(name = "AbstractFacadeEJB")*/
public abstract class
AbstractFacadeBean<T> {
    private Class<T> entityClass;

    public AbstractFacadeBean(Class<T> entityClass) {
        this.entityClass = entityClass;

    protected AbstractFacadeBean() {

    protected abstract EntityManager getEntityManager();

    public void create(T entity) {

    public void edit(T entity) {

    public void remove(T entity) {

    public T find(Object id) {
        return getEntityManager().find(entityClass, id);

    public List<T> findAll() {
        javax.persistence.criteria.CriteriaQuery cq = getEntityManager().getCriteriaBuilder().createQuery();;
        return getEntityManager().createQuery(cq).getResultList();

    public List<T> findRange(int[] range) {
        javax.persistence.criteria.CriteriaQuery cq = getEntityManager().getCriteriaBuilder().createQuery();;
        javax.persistence.Query q = getEntityManager().createQuery(cq);
        q.setMaxResults(range[1] - range[0] + 1);
        return q.getResultList();

    public int count() {
        javax.persistence.criteria.CriteriaQuery cq = getEntityManager().getCriteriaBuilder().createQuery();
        javax.persistence.criteria.Root<T> rt = cq.from(entityClass);;
        javax.persistence.Query q = getEntityManager().createQuery(cq);
        return ((Long) q.getSingleResult()).intValue();


The error message shows as: Class should not be defined as EJB and Interceptor at the same time.

details please see the attachment.



Please sign in to leave a comment.