Package nexj.core.persistence

Examples of nexj.core.persistence.PersistenceException


      }
      catch (SQLException e)
      {
         m_adapter.flushLog(e);

         PersistenceException x = m_adapter.getException(e, null, 0, 0);

         if (x instanceof QueryTimeoutException)
         {
            logTimeout(lStartTime, !m_adapter.isDebug());
         }
View Full Code Here


    */
   public void initialize() throws Exception
   {
      if (m_fragment == null || !m_fragment.getDataSource().isEnabled())
      {
         throw new PersistenceException("err.persistence.sqlConnectionProperties");
      }

      m_managedFactory = (SQLManagedConnectionFactory)Class.forName(
            SysUtil.PACKAGE + ".core.rpc.sql.ra.SQLManagedConnectionFactory").newInstance();

View Full Code Here

         if (assocMapping.getKey(true).isObjectKeyPart())
         {
            return false;
         }

         throw new PersistenceException("err.persistence.requiredOID",
            new Object[]{assocMapping.getPersistenceMapping().getMetaclass().getName()});
      }

      return false;
   }
View Full Code Here

            Index pk = primaryTable.getPrimaryKey();
            int nCount = pk.getIndexColumnCount();

            if (nCount != values.length)
            {
               throw new PersistenceException("err.persistence.oidValueCount",
                  new Object[]{component.getName(), Primitive.createInteger(nCount),
                     Primitive.createInteger(values.length)});
            }

            for (int i = 0; i < nCount; ++i)
View Full Code Here

         if (!isCompatible(con, db))
         {
            String sDBName = con.getMetaData().getDatabaseProductName();
            String sDBVersion = con.getMetaData().getDatabaseProductVersion();

            throw new PersistenceException("err.persistence.adapterMismatch",
               new Object[]{db.getName(), db.getAdapter().getName(),
                  (sDBVersion.contains(sDBName)) ? sDBVersion : (sDBName + " " + sDBVersion)});
         }

         stmt = con.prepareStatement(sSQL);

         ResultSet rs = executeQuery(stmt);

         if (!rs.next())
         {
            throw new PersistenceException("err.persistence.noStorageVersion",
               new Object[]{db.getName()});
         }

         SchemaVersion version = new SchemaVersion();

         version.setNamespace(Primitive.toString(getBind(namespaceColumn).getValue(rs, 0, this)));
         version.setVersion(Primitive.toString(getBind(versionColumn).getValue(rs, 1, this)));

         Integer step = Primitive.toInteger(getBind(stepColumn).getValue(rs, 2, this));

         version.setStep((step == null) ? -1 : step.intValue());

         Boolean upgradable = Primitive.toBoolean(getBind(upgradableColumn).getValue(rs, 3, this));

         version.setUpgradable((upgradable == null) ? false : upgradable.booleanValue());

         Boolean test = Primitive.toBoolean(getBind(testColumn).getValue(rs, 4, this));

         version.setTest((test == null) ? false : test.booleanValue());

         // has to be done while still have data in ResultSet on DB2
         Boolean unicode = isUnicode((RelationalSchema)schema, rs, 1); // 1 == "namespace" column
         boolean bUnicode = db.isUnicode();

         if (unicode == null)
         {
            throw new PersistenceException(
               "err.persistence.sql.unicodeUnknown",
               new Object[]{db.getName(), Boolean.valueOf(bUnicode)});
         }

         if (unicode.booleanValue() != bUnicode)
         {
            throw new PersistenceException(
               "err.persistence.sql.unicodeMismatch",
               new Object[]{db.getName(), Boolean.valueOf(bUnicode)});
         }

         if (rs.next())
         {
            throw new PersistenceException("err.persistence.ambiguousStorageVersion",
               new Object[]{db.getName()});
         }

         return version;
      }
      catch (SQLException e)
      {
         throw new PersistenceException("err.persistence.checkVersion",
            new Object[]{db.getName()}, e);
      }
      finally
      {
         close(stmt);
View Full Code Here

         getBind(stepColumn).setValue(stmt, 1, Primitive.createInteger(version.getStep()), this);
         getBind(namespaceColumn).setValue(stmt, 2, version.getNamespace(), this);

         if (executeUpdate(stmt) != 1)
         {
            throw new PersistenceException("err.persistence.noStorageNamespace",
               new Object[]{schema.getDataSource().getName(), version.getNamespace()});
         }
      }
      catch (SQLException e)
      {
         throw new PersistenceException("err.persistence.setVersion",
            new Object[]{schema.getDataSource().getName()}, e);
      }
      finally
      {
         close(stmt);
View Full Code Here

      {
         throw getException(e, null, 0, 0);
      }
      catch (RuntimeException e)
      {
         throw new PersistenceException(
            "err.persistence.upgrade.apply",
            new Object[]{
               version.getNamespace(),
               version.getVersion(),
               Primitive.createInteger(version.getStep())},
View Full Code Here

      if (isLockTimeoutException(e))
      {
         return new LockTimeoutException(e);
      }

      return new PersistenceException("err.persistence.sql", e);
   }
View Full Code Here

      if (result == null)
      {
         return EmptyIterator.getInstance();
      }

      throw new PersistenceException("err.persistence.virtual.invalidReadResult",
         new Object[]{metaclass.getName(), result.getClass().getCanonicalName()});
   }
View Full Code Here

            assert metaclass == m_query.getMetaclass();

            if (oid == null)
            {
               PersistenceException ex = new PersistenceException("err.persistence.virtual.missingOID",
                  new Object[]{metaclass.getName()});

               ex.setValue("result", tobj);

               throw ex;
            }

            // Set the attributes that are mapped to the OID key parts
View Full Code Here

TOP

Related Classes of nexj.core.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.