Examples of beginTx()


Examples of com.krminc.phr.dao.PersistenceService.beginTx()

            //check updateable
            if (getEntity().getDataSourceId() != 1) {
                throw new WebApplicationException(Response.Status.FORBIDDEN);
            }
           
            persistenceSvc.beginTx();
            deleteEntity(getEntity());
            persistenceSvc.commitTx();
        } finally {
            persistenceSvc.close();
        }
View Full Code Here

Examples of com.krminc.phr.dao.PersistenceService.beginTx()

     */
    @DELETE
    public void delete() {
        PersistenceService persistenceSvc = PersistenceService.getInstance();
        try {
            persistenceSvc.beginTx();
            deleteEntity(getEntity());
            persistenceSvc.commitTx();
        } finally {
            persistenceSvc.close();
        }
View Full Code Here

Examples of com.krminc.phr.dao.PersistenceService.beginTx()

    @GET
    @Produces({ MediaType.APPLICATION_JSON })
    public JSONObject getUsernameAvailable() {
        PersistenceService persistenceSvc = PersistenceService.getInstance();
        try {
            persistenceSvc.beginTx();
            EntityManager em = persistenceSvc.getEntityManager();
            try {
                Long uId = (Long) em.createNamedQuery("User.findUserIdByUsername")
                    .setParameter("username", username)
                    .getSingleResult();
View Full Code Here

Examples of com.krminc.phr.dao.PersistenceService.beginTx()

        if (password == null || password.length() == 0) {
            throw new WebApplicationException(Response.Status.BAD_REQUEST);
        }
        PersistenceService persistenceSvc = PersistenceService.getInstance();
        try {
            persistenceSvc.beginTx();
            User updatedUser = getEntity();
            updatedUser.setPassword(password);
            updatedUser.setRequiresReset(Boolean.TRUE);
            updateEntity(getEntity(), updatedUser);
            persistenceSvc.commitTx();
View Full Code Here

Examples of com.krminc.phr.dao.PersistenceService.beginTx()

            @QueryParam("orderBy") @DefaultValue("dateadded") String orderBy,
            @QueryParam("desc") @DefaultValue("1") int desc)
    {
        PersistenceService persistenceSvc = PersistenceService.getInstance();
        try {
            persistenceSvc.beginTx();
            return new WeightsConverter(
                getEntities(start, max, source, orderBy, desc),
                uriInfo.getAbsolutePath(),
                Api.DEFAULT_EXPAND_LEVEL
            );
View Full Code Here

Examples of com.krminc.phr.dao.PersistenceService.beginTx()

        try {
            if (data.hasError) {
                throw new WebApplicationException(Response.Status.PRECONDITION_FAILED);
            }

            persistenceSvc.beginTx();
            EntityManager em = persistenceSvc.getEntityManager();
            Weight entity = data.resolveEntity(em);
            createEntity(data.resolveEntity(em));
            persistenceSvc.commitTx();
            return Response.created(uriInfo.getAbsolutePath().resolve(entity.getWeightId() + "/")).build();
View Full Code Here

Examples of com.krminc.phr.dao.PersistenceService.beginTx()

    @GET
    @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
    public MedicationConverter get() {
        PersistenceService persistenceSvc = PersistenceService.getInstance();
        try {
            persistenceSvc.beginTx();
            return new MedicationConverter(getEntity(), uriInfo.getAbsolutePath(), Api.DEFAULT_EXPAND_LEVEL);
        } finally {
            PersistenceService.getInstance().close();
        }
    }
View Full Code Here

Examples of com.krminc.phr.dao.PersistenceService.beginTx()

            if (data.hasError) {
                throw new WebApplicationException(Response.Status.PRECONDITION_FAILED);
            }

            persistenceSvc.beginTx();
            EntityManager em = persistenceSvc.getEntityManager();
            updateEntity(getEntity(), data.resolveEntity(em));
            persistenceSvc.commitTx();
        } finally {
            persistenceSvc.close();
View Full Code Here

Examples of com.krminc.phr.dao.PersistenceService.beginTx()

    @GET
    @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
    public TemperatureConverter get() {
        PersistenceService persistenceSvc = PersistenceService.getInstance();
        try {
            persistenceSvc.beginTx();
            return new TemperatureConverter(getEntity(), uriInfo.getAbsolutePath(), Api.DEFAULT_EXPAND_LEVEL);
        } finally {
            PersistenceService.getInstance().close();
        }
    }
View Full Code Here

Examples of com.krminc.phr.dao.PersistenceService.beginTx()

            //check updateable
            if (getEntity().getDataSourceId() != 1) {
                throw new WebApplicationException(Response.Status.FORBIDDEN);
            }

            persistenceSvc.beginTx();
            deleteEntity(getEntity());
            persistenceSvc.commitTx();
        } finally {
            persistenceSvc.close();
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.