Package siena

Examples of siena.SienaException


      accFrom.getPersistenceManager().beginTransaction();
      accFrom.amount-=100L;
      accFrom.save();
      accTo.amount+=100L;
      accTo.save();
      throw new SienaException("problem");
    }catch(SienaException e){
      accFrom.getPersistenceManager().rollbackTransaction();
    }finally{
      accFrom.getPersistenceManager().closeConnection();
    }
View Full Code Here


        try {
            Connection c = getConnection();
            c.setAutoCommit(false);
            c.setTransactionIsolation(isolationLevel);
        } catch (SQLException e) {
            throw new SienaException(e);
        }
    }
View Full Code Here

    public void beginTransaction() {
        try {
            Connection c = getConnection();
            c.setAutoCommit(false);
        } catch (SQLException e) {
            throw new SienaException(e);
        }
    }
View Full Code Here

    public void commitTransaction() {
        try {
            Connection c = getConnection();
            c.commit();
        } catch (SQLException e) {
            throw new SienaException(e);
        }
    }
View Full Code Here

    public void rollbackTransaction() {
        try {
            Connection c = getConnection();
            c.rollback();
        } catch (SQLException e) {
            throw new SienaException(e);
        }
    }
View Full Code Here

          Future<Map<Key, Entity>> entities = ds.get(fieldMap.get(field));
          // gets the future here because we need it!
          entityMap.put(field, entities.get());
        }
      }catch(Exception ex){
        throw new SienaException(ex);
      }
      // associates linked models to their models
      // linkedModels is just a map to contain entities already mapped
      Map<Key, Object> linkedModels = new HashMap<Key, Object>();
      Object linkedObj;
      Entity entity;
     
      for(Field field: fieldMap.keySet()){
        Object objVal = field.get(model);
        Key key = GaeMappingUtils.getKey(objVal);
        linkedObj = linkedModels.get(key);
        if(linkedObj==null){
          entity = entityMap.get(field).get(key);
          linkedObj = objVal;
          GaeMappingUtils.fillModel(linkedObj, entity);
          linkedModels.put(key, linkedObj);
        }
     
        field.set(model, linkedObj);       
      }

      return model;
    } catch(IllegalAccessException ex){
      throw new SienaException(ex);
    }   
  }
View Full Code Here

          Future<Map<Key, Entity>> entities = ds.get(fieldMap.get(field));
          // gets the future here because we need it so we wait for it
          entityMap.put(field, entities.get());
        }
      }catch(Exception ex){
        throw new SienaException(ex);
      }
      // associates linked models to their models
      // linkedModels is just a map to contain entities already mapped
      Map<Key, Object> linkedModels = new HashMap<Key, Object>();
      Object linkedObj;
      Entity entity;
     
      for (final T model : models) {
        for(Field field: fieldMap.keySet()){
          Object objVal = Util.readField(model, field);
                    // our object is not linked to another object...so it doesn't have any key
                    if(objVal == null) {
                        continue;
                    }
          Key key = GaeMappingUtils.getKey(objVal);
          linkedObj = linkedModels.get(key);
          if(linkedObj==null){
            entity = entityMap.get(field).get(key);
            linkedObj = objVal;
            GaeMappingUtils.fillModel(linkedObj, entity);
            linkedModels.put(key, linkedObj);
          }
       
          field.set(model, linkedObj);       
        }
      }
      return models;
    } catch(IllegalAccessException ex){
      throw new SienaException(ex);
    }   
  }
View Full Code Here

              }
      };
     
      return new SienaFutureContainer<T>(wrapped);
    } catch (Exception e) {
      throw new SienaException(e);
    }
  }
View Full Code Here

        if(!wasAccessible){
          m.setAccessible(false);
        }
      }      
    }catch (IllegalArgumentException e) {
      throw new SienaException(e);
    } catch (IllegalAccessException e) {
      throw new SienaException(e);
    } catch (InvocationTargetException e) {
      throw new SienaException(e);
    }
   
  }
View Full Code Here

    try {
      jsonOpt.value = JsonSerializer.serializeMap(this);
    }catch(SienaException e) {
      throw e;
    } catch(Exception e) {
      throw new SienaException(e);
    }
   
    return JsonSerializer.serialize(jsonOpt);
  }
View Full Code Here

TOP

Related Classes of siena.SienaException

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.