In netbeans versions previous 7.0 was possible to write the following,
@Stateless(mappedName="Soelprotocol")
public class ProtocolFacade implements ProtocolFacadeLocal, ProtocolFacadeRemote {
@PersistenceContext(unitName = "SOEL-ejbPU")
private EntityManager em;
public void create(Protocol protocol) {
em.persist(protocol);
}
public void edit(Protocol protocol) {
em.merge(protocol);
}
public void remove(Protocol protocol) {
em.remove(em.merge(protocol));
}
public Protocol find(Object id) {
return em.find(Protocol.class, id);
}
public List<Protocol> findAll() {
CriteriaQuery cq = em.getCriteriaBuilder().createQuery();
cq.select(cq.from(Protocol.class));
return em.createQuery(cq).getResultList();
}
public List<Protocol> findRange(int[] range) {
CriteriaQuery cq = em.getCriteriaBuilder().createQuery();
cq.select(cq.from(Protocol.class));
Query q = em.createQuery(cq);
q.setMaxResults(range[1] - range[0]);
q.setFirstResult(range[0]);
return q.getResultList();
}
public int count() {
CriteriaQuery cq = em.getCriteriaBuilder().createQuery();
Root<Protocol> rt = cq.from(Protocol.class);
cq.select(em.getCriteriaBuilder().count(rt));
Query q = em.createQuery(cq);
return ((Long) q.getSingleResult()).intValue();
}
}
When I try to create a remote session bean for database entity beans the check box label says "Remote in a project" with a message:
There is no suitable project available into which Remote interface could be stored. An open Ant based Java Class Library project is required.
With netbans 7.0 how to create an application client that uses remote session beans that created for database entity beans?
Is somewhere an complete example?