Java Reference
In-Depth Information
import javax.ws.rs.POST;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
@Stateless
@Path("com.ensode.netbeansbook.jaxrs.customer")
public class CustomerFacadeREST extends AbstractFacade<Customer> {
@PersistenceContext(unitName = "jaxrsPU")
private EntityManager em;
@java.lang.Override
protected EntityManager getEntityManager() {
return em;
}
public CustomerFacadeREST() {
super(Customer.class);
}
@POST
@Override
@Consumes({"application/xml", "application/json"})
public void create(Customer entity) {
super.create(entity);
}
@PUT
@Override
@Consumes({"application/xml", "application/json"})
public void edit(Customer entity) {
super.edit(entity);
}
@DELETE
@Path("{id}")
public void remove(@PathParam("id")
Integer id) {
super.remove(super.find(id));
}
@GET
@Path("{id}")
@Produces({"application/xml", "application/json"})
public Customer find(@PathParam("id")
Integer id) {
return super.find(id);
}
 
Search WWH ::




Custom Search