Package org.mybeans.dao

Examples of org.mybeans.dao.DAOException


      BeanTable<MedLog> MedTable = BeanTable.getInstance(MedLog.class, "Logmedication_table");
      if(!MedTable.exists()) MedTable.create("medId");
      MedTable.setIdleConnectionCleanup(true);
      factory = MedTable.getFactory();
    }catch(BeanFactoryException e){
      throw new DAOException(e);
    }
  }
View Full Code Here


      Transaction.begin();
      MedLog dbMed = factory.create(med.getMedId());
      factory.copyInto(med,dbMed);
      Transaction.commit();
    }catch(DuplicateKeyException e){
      throw new DAOException("A log medication belongs to " + med.getOwner() + "has already existed.");
    }catch(RollbackException e){
      throw new DAOException(e);
    }finally{
      if(Transaction.isActive()) Transaction.rollback();
    }
  }
View Full Code Here

    try{
      MedLog[] meds = factory.match(MatchArg.equals("owner",UserName));
      return meds;
    }catch(RollbackException e){
      try {
        throw new DAOException(e);
      } catch (DAOException e1) {
        // TODO Auto-generated catch block
        e1.printStackTrace();
      }
    }
View Full Code Here

    try{
      MedLog[] meds = factory.match(MatchArg.and(MatchArg.equals("name",name), MatchArg.equals("owner", user)));
      return meds;
    }catch(RollbackException e){
      try {
        throw new DAOException(e);
      } catch (DAOException e1) {
        // TODO Auto-generated catch block
        e1.printStackTrace();
      }
    }
View Full Code Here

  }
  public int getLogMedNum(String UserName) throws DAOException{
    try{
      return factory.match(MatchArg.equals("owner",UserName)).length;
    }catch(RollbackException e){
      throw new DAOException(e);
    }
  }
View Full Code Here

  }
  public int size() throws DAOException{
    try{
      return factory.getBeanCount();
    }catch(RollbackException e){
      throw new DAOException(e);
    }
  }
View Full Code Here

        }
          Transaction.commit();
          return Large;
      }catch (RollbackException e) {
        try {
          throw new DAOException(e);
        } catch (DAOException e1) {
          // TODO Auto-generated catch block
          e1.printStackTrace();
        }
      }
View Full Code Here

      BeanTable<Medication> MedTable = BeanTable.getInstance(Medication.class, "medication_table");
      if(!MedTable.exists()) MedTable.create("medid");
      MedTable.setIdleConnectionCleanup(true);
      factory = MedTable.getFactory();
    }catch(BeanFactoryException e){
      throw new DAOException(e);
    }
  }
View Full Code Here

      Transaction.begin();
      Medication dbMed = factory.create(med.getMedid());
      factory.copyInto(med,dbMed);
      Transaction.commit();
    }catch(DuplicateKeyException e){
      throw new DAOException("A medication named " + med.getName() + "has already existed.");
    }catch(RollbackException e){
      throw new DAOException(e);
    }finally{
      if(Transaction.isActive()) Transaction.rollback();
    }
  }
View Full Code Here

  public Medication lookup(String MedName){
    try{
      return factory.lookup(MedName);
    }catch(RollbackException e){
      try {
        throw new DAOException(e);
      } catch (DAOException e1) {
        // TODO Auto-generated catch block
        e1.printStackTrace();
      }
    }
View Full Code Here

TOP

Related Classes of org.mybeans.dao.DAOException

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.