annotation type not applicable to this kind of declaration
Asked Answered
C

1

1
package com;

/**
 *
 * @author sunny
 */
import javax.ejb.Local;

public interface BookService {

    @Local   //error here (annotation type not applicable to this kind of declaration)
    Book createOrUpdate(Book book);
    void remove(Book book);
    Book find(Object id);
}
Culminate answered 13/3, 2012 at 5:31 Comment(1)
Place annotation above interface declaration, tutorial docs.oracle.com/javaee/6/tutorial/doc recommended.Kingsize
A
1

Write your local interface like so:

package com;

public interface BookServiceLocal {

    Book createOrUpdate(Book book);
    void remove(Book book);
    Book find(Object id);
}

Then add the local interface to your EJB class via the annotation:

package com;

import javax.ejb.Local;

@Stateless //Or any other type of EJB you want
@Local (BookServiceLocal.class) 
public BookService {

    Book createOrUpdate(Book book){return null;}
    void remove(Book book){}
    Book find(Object id){return null;}
}
Armentrout answered 13/3, 2012 at 11:4 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.