Package javax.persistence

Examples of javax.persistence.PersistenceException


    if (config.getDataSourceJndiName() != null) {
      ds = jndiDataSourceFactory.lookup(config.getDataSourceJndiName());
      if (ds == null) {
        String m = "JNDI lookup for DataSource " + config.getDataSourceJndiName() + " returned null.";
        throw new PersistenceException(m);
      } else {
        return ds;
      }
    }

    DataSourceConfig dsConfig = config.getDataSourceConfig();
    if (dsConfig == null) {
      String m = "No DataSourceConfig definded for " + config.getName();
      throw new PersistenceException(m);
    }

    if (dsConfig.isOffline()) {
      if (config.getDatabasePlatformName() == null) {
        String m = "You MUST specify a DatabasePlatformName on ServerConfig when offline";
        throw new PersistenceException(m);
      }
      return null;
    }

    DataSourceAlert notify = new SimpleDataSourceAlert();
View Full Code Here


      if (data != null) {
        dataClass = data.getClass().getName();
      }
      String m = "Error with property[" + b.currentPos() + "] dt[" + dataType + "]";
      m += "data[" + data + "][" + dataClass + "]";
      throw new PersistenceException(m, e);
    }
  }
View Full Code Here

      }

      return true;

    } catch (SQLException ex) {
      throw new PersistenceException(ex);

    } finally {
      if (c != null) {
        try {
          c.close();
View Full Code Here

  public int getTotalRowCount() {
    try {
      return getFutureRowCount().get();
    } catch (Exception e) {
      throw new PersistenceException(e);
    }
  }
View Full Code Here

    Class<?> cls = ParamTypeUtil.findParamType(controller, BeanPersistListener.class);
    if (cls == null) {
      String msg = "Could not determine the entity class (generics parameter type) from " + controller
          + " using reflection.";
      throw new PersistenceException(msg);
    }
    return cls;
  }
View Full Code Here

      return ((Map<?, ?>) o).entrySet();

    } else if (o instanceof Collection<?>) {
      return ((Collection<?>) o);
    }
    throw new PersistenceException("expecting a Map or Collection but got [" + o.getClass().getName() + "]");
  }
View Full Code Here

    if (matches == null) {
      String m = "Matches for the concatinated key columns where not found?"
          + " I expect that the concatinated key was null, and this bean does"
          + " not have ManyToOne assoc beans matching the primary key columns?";
      throw new PersistenceException(m);
    }

    EntityBean bean = persist.getEntityBean();

    // create the new id
View Full Code Here

                return rowCount;
              
            }

        } catch (SQLException ex) {
            throw new PersistenceException(ex);

        } finally {
            if (!batchThisRequest && cstmt != null) {
                try {
                  cstmt.close();
View Full Code Here

    if (!dir.exists()) {
      // automatically create the directory if it does not exist.
      // this is probably a fairly reasonable thing to do
      if (!dir.mkdirs()) {
        String m = "Unable to create directory [" + dir + "] for autofetch file ["+ fileName + "]";
        throw new PersistenceException(m);
      }
    }

    return new File(dir, fileName);
  }
View Full Code Here

      bindLog = predicates.bind(new DataBind(pstmt));
 
      rset = pstmt.executeQuery();
     
      if (!rset.next()){
        throw new PersistenceException("Expecting 1 row but got none?");
      }

      rowCount = rset.getInt(1);
     
      long exeNano = System.nanoTime() - startNano;
View Full Code Here

TOP

Related Classes of javax.persistence.PersistenceException

Copyright © 2018 www.massapicom. 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.