Examples of MException


Examples of de.mhus.lib.MException

  public DbCollection(DbManager manager, DbConnection con, boolean ownConnection, String registryName, O object, DbResult res) throws MException {
   
    if (registryName == null) {
      Class<?> clazz = manager.getSchema().findClassForObject(object,manager);
      if (clazz == null)
        throw new MException("class definition not found for object",object.getClass().getCanonicalName(),registryName);
      registryName = clazz.getCanonicalName();
    }
   
    this.manager = manager;
    this.res = res;
View Full Code Here

Examples of de.mhus.lib.MException

    O out = object;
    if (!recycle) {
      try {
        out = (O)manager.getSchema().createObject(object instanceof Class<?> ? (Class<?>)object : object.getClass(),registryName,res,manager);
      } catch (Throwable t) {
        throw new MException(con,t);
      }
    }
   
    manager.fillObject(registryName, out, con, res);
    return out;
View Full Code Here

Examples of de.mhus.lib.MException

    DbConnection myCon = null;
    if (con == null) {
      try {
        myCon = pool.getConnection();
      } catch (Throwable t) {
        throw new MException(con,query,attributes,t);
      }
      con = myCon;
    }
    if (attributes == null)
      map = nameMappingRO;
    else
      map = new FallbackMap<String, Object>(attributes, nameMappingRO, true);
    try {
      DbStatement sth = con.createStatement(query);
      DbResult res = sth.executeQuery(map);
      return new DbCollection<T>(this,con,myCon != null,registryName,clazz,res);
    } catch (Throwable t) {
      throw new MException(con,query,attributes,t);
    } finally {
    // do not close, it's used by the collection
    //  if (myCon != null)
    //    myCon.close();
    }
View Full Code Here

Examples of de.mhus.lib.MException

    if (con == null) {
      try {
        myCon = pool.getConnection();
        con = myCon;
      } catch (Throwable t) {
        throw new MException(t);
      }
    }
   
    Table c = cIndex.get(registryName);
    if (c == null)
      throw new MException("class definition not found in schema",registryName);
   
    try {
      Object out = c.getObject(con,keys);
     
      if (myCon != null) {
        try {
          myCon.commit();
        } catch (Throwable t) {
          throw new MException(t);
        }
        myCon.close();
      }
     
      return out;
    } catch (Throwable t) {
      throw new MException(registryName,t);
    }
  }
View Full Code Here

Examples of de.mhus.lib.MException

  void fillObject(String registryName, Object object, DbConnection con, DbResult res) throws MException {

    if (registryName == null) {
      Class<?> clazz = getSchema().findClassForObject(object,this);
      if (clazz == null)
        throw new MException("class definition not found for object",object.getClass().getCanonicalName(),registryName);
      registryName = clazz.getCanonicalName();
    }

    Table c = cIndex.get(registryName);
    if (c == null)
      throw new MException("class definition not found in schema",registryName);
   
    try {
      if (object == null) {
       
        object = schema.createObject(c.getClazz(), registryName, res, this);
      }
      c.fillObject(object,con,res);
     
      schema.doPostLoad(c,object,con, this);
     
    } catch (Throwable t) {
      throw new MException(registryName,t);
    }
  }
View Full Code Here

Examples of de.mhus.lib.MException

    if (con == null) {
      try {
        myCon = pool.getConnection();
        con = myCon;
      } catch (Throwable t) {
        throw new MException(t);
      }
    }
   
    if (registryName == null) {
      Class<?> clazz = schema.findClassForObject(object,this);
      if (clazz == null)
        throw new MException("class definition not found for object",object.getClass().getCanonicalName(),registryName);
      registryName = clazz.getCanonicalName();
    }

    Table c = cIndex.get(registryName);
    if (c == null)
      throw new MException("class definition not found in schema",registryName);

    LinkedList<Object> keys = new LinkedList<Object>();
    try {
      for (Field f : c.getPrimaryKeys()) {
        keys.add(f.getFromTarget(object));
      }
     
      if (c.fillObject(con,object,keys.toArray()) == null)
        throw new MException("object not found");
     
      schema.doPostLoad(c,object,con,this);
     
    } catch (Throwable t) {
      throw new MException(registryName,t);
    }
   
    if (myCon != null) {
      try {
        myCon.commit();
      } catch (Throwable t) {
        throw new MException(t);
      }
      myCon.close();
    }
  }
View Full Code Here

Examples of de.mhus.lib.MException

    if (con == null) {
      try {
        myCon = pool.getConnection();
        con = myCon;
      } catch (Throwable t) {
        throw new MException(t);
      }
    }
   
    if (registryName == null) {
      Class<?> clazz = schema.findClassForObject(object,this);
      if (clazz == null)
        throw new MException("class definition not found for object",object.getClass().getCanonicalName(),registryName);
      registryName = clazz.getCanonicalName();
    }

    Table c = cIndex.get(registryName);
    if (c == null)
      throw new MException("class definition not found in schema",registryName);

    boolean ret = false;
    LinkedList<Object> keys = new LinkedList<Object>();
    try {
      for (Field f : c.getPrimaryKeys()) {
        keys.add(f.getFromTarget(object));
      }
     
      ret = c.objectChanged(con,object,keys.toArray());
     
      // schema.doPostLoad(c,object,con,this);
     
    } catch (Throwable t) {
      throw new MException(registryName,t);
    }
   
    if (myCon != null) {
      try {
        myCon.commit();
      } catch (Throwable t) {
        throw new MException(t);
      }
      myCon.close();
    }
   
    return ret;
View Full Code Here

Examples of de.mhus.lib.MException

    if (con == null) {
      try {
        myCon = pool.getConnection();
        con = myCon;
      } catch (Throwable t) {
        throw new MException(t);
      }
    }
   
    if (registryName == null) {
      Class<?> clazz = schema.findClassForObject(object,this);
      if (clazz == null)
        throw new MException("class definition not found for object",object.getClass().getCanonicalName(),registryName);
      registryName = clazz.getCanonicalName();
    }

    Table c = cIndex.get(registryName);
    if (c == null)
      throw new MException("class definition not found in schema",registryName);
   
    try {
      c.fillObject(con,object,keys);
     
      schema.doPostLoad(c,object,con,this);
     
    } catch (Throwable t) {
      throw new MException(registryName,t);
    }
   
    if (myCon != null) {
      try {
        myCon.commit();
      } catch (Throwable t) {
        throw new MException(t);
      }
      myCon.close();
    }
   
  }
View Full Code Here

Examples of de.mhus.lib.MException

    if (con == null) {
      try {
        myCon = pool.getConnection();
        con = myCon;
      } catch (Throwable t) {
        throw new MException(t);
      }
    }
   
    if (registryName == null) {
      Class<?> clazz = schema.findClassForObject(object,this);
      if (clazz == null)
        throw new MException("class definition not found for object",object.getClass().getCanonicalName(),registryName);
      registryName = clazz.getCanonicalName();
    }
    Table c = cIndex.get(registryName);
    if (c == null)
      throw new MException("class definition not found in schema",registryName);
   
    try {
      // prepare object
      c.prepareCreate(object);
      schema.doPreCreate(c,object,con,this);
     
      //save object
   
      c.createObject(con,object);
     
      schema.doPostLoad(c,object,con,this);

    } catch (Throwable t) {
      throw new MException(registryName,t);
    }
   
    if (myCon != null) {
      try {
        myCon.commit();
      } catch (Throwable t) {
        throw new MException(t);
      }
      myCon.close();
    }
  }
View Full Code Here

Examples of de.mhus.lib.MException

    if (con == null) {
      try {
        myCon = pool.getConnection();
        con = myCon;
      } catch (Throwable t) {
        throw new MException(t);
      }
    }
   
    if (registryName==null) {
      Class<?> clazz = schema.findClassForObject(object,this);
      if (clazz == null)
        throw new MException("class definition not found for object",object.getClass().getCanonicalName());
      registryName = clazz.getCanonicalName();
    }
    Table c = cIndex.get(registryName);
    if (c == null)
      throw new MException("class definition not found in schema",registryName);
   
    try {
      // prepare object
      schema.doPreSave(c,object,con,this);
     
      //save object
      c.saveObject(con,object);
    } catch (Throwable t) {
      throw new MException(registryName,t);
    }
   
    if (myCon != null) {
      try {
        myCon.commit();
      } catch (Throwable t) {
        throw new MException(t);
      }
      myCon.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.