I just completed a billiards tutorial ( http://www.jboss.org/jdf/examples/ticket-monster/tutorial/Introduction/ ) and added a relaxation class to my solution.
package projectFoo.rest;
import java.util.List;
import javax.enterprise.context.RequestScoped;
import javax.inject.Inject;
import javax.persistence.EntityManager;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import projectFoo.model.party;
@Path("/partys")
@RequestScoped
public class partyService {
@Inject
private EntityManager em;
@GET
@Produces(MediaType.APPLICATION_JSON)
public List<party> getAllEvents() {
@SuppressWarnings("unchecked")
final List<party> results =
em.createQuery(
"select e from party e order by e.name").getResultList();
return results;
}
}
@Inject emphasized, returns: "No bean has the right to inject at the injection point [JSR-299 §5.2.1]"
When I try to deploy the package, the process will fail and return the following message:
Unsatisfied dependencies for type [EntityManager] with qualifiers [@Default] at injection point.
Do I need to add a bean for Entity Manager? What should it look like? The manual does not mention this. In fact, I could not find any definition of beans in the final draft of the ticket monster.
source
share