Package javax.persistence

Examples of javax.persistence.Query.executeUpdate()


        doOperation("updateJob", new Callable<Void>() {
            public Void call() throws StoreException {
                Query q = entityManager.createNamedQuery("UPDATE_COORD_JOB");
                q.setParameter("id", job.getId());
                setJobQueryParameters(job, q);
                q.executeUpdate();
                return null;
            }
        });
    }
View Full Code Here


            public Void call() throws StoreException {
                Query q = entityManager.createNamedQuery("UPDATE_COORD_JOB_STATUS");
                q.setParameter("id", job.getId());
                q.setParameter("status", job.getStatus().toString());
                q.setParameter("lastModifiedTime", new Date());
                q.executeUpdate();
                return null;
            }
        });
    }
View Full Code Here

                    for (CoordinatorJobBean coord : coordJobs) {
                        String jobId = coord.getId();
                        entityManager.remove(coord);
                        Query g = entityManager.createNamedQuery("DELETE_COMPLETED_ACTIONS_FOR_COORDINATOR");
                        g.setParameter("jobId", jobId);
                        actionDeleted += g.executeUpdate();
                    }
                }

                XLog.getLog(getClass()).debug("ENDED Coord Purge deleted jobs :" + coordJobs.size() + " and actions " + actionDeleted);
                return null;
View Full Code Here

   
    ut.begin();
    try {
     
      Query q = managedEm.createQuery("DELETE from Car c");
      q.executeUpdate();
     
      q = managedEm.createQuery("SELECT Count(c) from Car c");
      assertEquals(0l, q.getSingleResult());
     
      Car car = new Car();
View Full Code Here

   
    ut.begin();
    try {
     
      Query q = managedEm.createQuery("DELETE from Car c");
      q.executeUpdate();
     
      q = managedEm.createQuery("SELECT Count(c) from Car c");
      assertEquals(0l, q.getSingleResult());
    } finally {
      ut.commit();
View Full Code Here

            }

            if (TradeConfig.jpaLayer == TradeConfig.OPENJPA) {
                Query updateStatus = entityManager.createNamedQuery("orderejb.completeClosedOrders");
                updateStatus.setParameter("userID", userID);
                updateStatus.executeUpdate();
            }
            else if (TradeConfig.jpaLayer == TradeConfig.HIBERNATE) {
                /*
                 * Add logic to do update orders operation, because JBoss5'
                 * Hibernate 3.3.1GA DB2Dialect and MySQL5Dialect do not work
View Full Code Here

                AccountDataBeanImpl account = (AccountDataBeanImpl) findaccountid.getSingleResult();
                Integer accountid = account.getAccountID();
                Query updateStatus = entityManager.createNativeQuery("UPDATE orderejb o SET o.orderStatus = 'completed' WHERE "
                                                                     + "o.orderStatus = 'closed' AND o.ACCOUNT_ACCOUNTID  = ?");
                updateStatus.setParameter(1, accountid.intValue());
                updateStatus.executeUpdate();
            }
            return results;
        }
        catch (Exception e) {
            Log.error("TradeJpaCm.getClosedOrders", e);
View Full Code Here

            q.setParameter(2, Integer.valueOf(task.getLeaseTime()));
            q.setParameter(3, new Timestamp(runTime.getTime()));
            q.setParameter(4, task.getName());
            q.setParameter(5, taskLock.getTimeAquired());
            q.setParameter(6, new Timestamp(leaseExpiration.getTime()));
            int result = q.executeUpdate();
           
            if(result == 1) {
                return true;
            }
View Full Code Here

            Query q = strategy.getNamedUpdate(
                    "TaskLock.updateTimeLeasedByName&Client");
            q.setParameter(1, Integer.valueOf(0));
            q.setParameter(2, task.getName());
            q.setParameter(3, task.getClientId());
            int result = q.executeUpdate();
           
            if(result == 1) {
                return true;
            }
View Full Code Here

          q=em.createNamedQuery("removeAllOrderItem");
          q.executeUpdate();
          q=em.createNamedQuery("removeAllBackOrder");
          q.executeUpdate();             
          q=em.createNamedQuery("removeAllSupplier");
          q.executeUpdate();
            em.flush();
        } catch (Exception e) {
            Util.debug("ResetDB(deleteAll) -- Error deleting data from the database: "+e);
            e.printStackTrace();
        }
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.