package me.chriskramp.library;

import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import java.util.List;

@Path("/members")
@Produces(MediaType.APPLICATION_JSON)
public class MemberResource {

  private MemberDAO memberDAO;

  public MemberResource(MemberDAO memberDAO) {
    this.memberDAO = memberDAO;
  }

  @GET
  public List<Member> getAllMembers() {
    return memberDAO.getAllMembers();
  }

  @GET
  @Path("{id}")
  public Member getMember(@PathParam("id") Long id) {
    return memberDAO.findById(id);
  }

  @POST
  @Path("/create")
  @Consumes(MediaType.APPLICATION_JSON)
  public Member createMember(Member member) {
    return memberDAO.save(member);
  }
}

@@ -25,16 +25,68 @@
 brary;%0A%0A
+import com.yammer.dropwizard.hibernate.UnitOfWork;%0A%0A
 import j
@@ -508,16 +508,30 @@
 %0A  @GET%0A
+  @UnitOfWork%0A
   public
@@ -558,24 +558,24 @@
 Members() %7B%0A
-
     return m
@@ -612,16 +612,30 @@
 %0A  @GET%0A
+  @UnitOfWork%0A
   @Path(
@@ -740,16 +740,16 @@
  %7D%0A%0A
-
   @POST%0A
   @P
@@ -744,16 +744,30 @@
   @POST%0A
+  @UnitOfWork%0A
   @Path(

Annotate MemberDAO DB access methods with @UnitOfWork