Package javax.persistence

Examples of javax.persistence.EntityManager.createNativeQuery()


   public Query createNativeQuery(String sqlString, Class resultClass)
   {
      EntityManager em = getEntityManager();
      if (!factory.isInTx()) em.clear(); // em will be closed by interceptor
      return em.createNativeQuery(sqlString, resultClass);
   }

   public Query createNativeQuery(String sqlString, String resultSetMapping)
   {
      EntityManager em = getEntityManager();
View Full Code Here


   public Query createNativeQuery(String sqlString, String resultSetMapping)
   {
      EntityManager em = getEntityManager();
      if (!factory.isInTx()) em.clear(); // em will be closed by interceptor
      return em.createNativeQuery(sqlString, resultSetMapping);
   }

   public <A> A find(Class<A> entityClass, Object primaryKey)
   {
      EntityManager em = getEntityManager();
View Full Code Here

   public Query createNativeQuery(String sqlString)
   {
      EntityManager em = getEntityManager();
      if (!factory.isInTx()) em.clear(); // em will be closed by interceptor
      return em.createNativeQuery(sqlString);
   }

   public Query createNativeQuery(String sqlString, Class resultClass)
   {
      EntityManager em = getEntityManager();
View Full Code Here

   public Query createNativeQuery(String sqlString, Class resultClass)
   {
      EntityManager em = getEntityManager();
      if (!factory.isInTx()) em.clear(); // em will be closed by interceptor
      return em.createNativeQuery(sqlString, resultClass);
   }

   public Query createNativeQuery(String sqlString, String resultSetMapping)
   {
      EntityManager em = getEntityManager();
View Full Code Here

   public Query createNativeQuery(String sqlString, String resultSetMapping)
   {
      EntityManager em = getEntityManager();
      if (!factory.isInTx()) em.clear(); // em will be closed by interceptor
      return em.createNativeQuery(sqlString, resultSetMapping);
   }

   public <A> A find(Class<A> entityClass, Object primaryKey)
   {
      EntityManager em = getEntityManager();
View Full Code Here

      IDataSet dataSet = runnable.getDesignInstance().getDataSet(handle.getDataSetName());
      String queryText = dataSet.getQueryText();
      String sortByColumn = extractSqlColumn(handle.getSortByColumn());
      queryText += " order by " + sortByColumn;
      queryText += " " + handle.getSortDirection();
      Query query = em.createNativeQuery(queryText);
      Iterator<?> iterator = query.getResultList().iterator();
      while (iterator.hasNext()) {
        Object object[] = (Object[]) iterator.next();
        LabelValueBean bean = new LabelValueBean((String) object[position], (String) object[position]);
        v.add(bean);
View Full Code Here

  }
 
  private void executeQuery(String sql, boolean ignoreException) throws Exception {
    EntityManager em = JpaConnection.getInstance().getCurrentEntityManager();
    try {
      Query query = em.createNativeQuery(sql);
      query.executeUpdate();
    }
    catch (Exception e) {
      logger.error(e);
      if (!ignoreException) {
View Full Code Here

    private void doPing() throws Exception {
        final String varDate = "fake" + (new Date()).getTime();
        final EntityManager em = _instance.createEntityManager();
        try {
            final Query qry = em.createNativeQuery("select COUNT(*) from _pingtable where "
                    + "FIELD='" + varDate + "'");
            List list = qry.getResultList();
        } finally {
            em.close();
        }
View Full Code Here

    public Query createNativeQuery(String sqlString) {
        final Timer timer = Op.createNativeQuery.start(this);
        try {
            EntityManager entityManager = getEntityManager();
            Query query = entityManager.createNativeQuery(sqlString);
            return proxyIfNoTx(entityManager, query);
        } finally {
            timer.stop();
        }
    }
View Full Code Here

    public Query createNativeQuery(String sqlString, Class resultClass) {
        final Timer timer = Op.createNativeQuery.start(this);
        try {
            EntityManager entityManager = getEntityManager();
            Query query = entityManager.createNativeQuery(sqlString, resultClass);
            return proxyIfNoTx(entityManager, query);
        } finally {
            timer.stop();
        }
    }
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.