/** * Remove (delete) a CompanyBDO object whose CompanyDO refers to the DO held by this BDO. * * @param r CompanyBDO to be deleted. * @param tran The transaction to be used for the commit. If null, a new transaction is created. * @exception DatabaseManagerException if could not create a transaction * @exception java.sql.SQLException if any SQL errors occur. * @exception DataObjectException If object is not found in the database. */ public void removeCompanyBDO(jobmatch.data.CompanyBDO rbdo, DBTransaction tran) throws SQLException, DatabaseManagerException, DataObjectException, RefAssertionException, DBRowUpdateException, QueryException { IndustryDO rdo = rbdo.getIndustry(); String rdoHandle = rdo.getHandle(); String mydoHandle = DO.getHandle(); if (null == rdoHandle || null == mydoHandle || (!rdoHandle.equals(mydoHandle))) { throw new DataObjectException( "Object " + rdo + " does not refer to object " + DO + ", cannot be removed this way."); } rbdo.delete(tran); }
/** * To the many-to-many relationship expressed by CompanyDO, add a AdressDO object that indirectly * refers to the DO held by this BDO. * * @param b The AdressBDO to add to the CompanyDO mapping for this BDO. * @exception DataObjectException If the object is not found in the database. */ public void mapAdress_via_CompanyBDO(jobmatch.data.AdressBDO b, DBTransaction tran) throws DataObjectException, DatabaseManagerException, RefAssertionException, SQLException, DBRowUpdateException, QueryException { jobmatch.data.CompanyBDO m = null; try { m = jobmatch.data.CompanyBDO.createVirgin(); } catch (Exception e) { throw new DataObjectException("jobmatch.data.CompanyBDO.createVirgin failed", e); } m.setAdress(b); m.setIndustry(this); m.commit(tran); }
/** * From the many-to-many relationship expressed by CompanyDO, remove (delete) the AdressDO object * that indirectly refers to the DO held by this BDO. * * @param b The AdressBDO to remove from the CompanyDO mapping for this BDO. * @exception DataObjectException If the object is not found in the database. */ public void unmapAdress_via_CompanyBDO(jobmatch.data.AdressBDO b, DBTransaction tran) throws DataObjectException, DatabaseManagerException, RefAssertionException, SQLException, DBRowUpdateException, QueryException { jobmatch.data.CompanyQuery q = new jobmatch.data.CompanyQuery(); q.setQueryIndustry(DO); q.setQueryAdress(b.getDO()); q.requireUniqueInstance(); jobmatch.data.CompanyBDO m = null; try { m = q.getNextBDO(); } catch (NonUniqueQueryException e) { throw new DataObjectException( "Multiple mappings for " + DO + " and " + b.getDO() + " in jobmatch.data.Company table."); } m.delete(tran); }
/** * Add (set & commit) a CompanyBDO object whose CompanyDO refers to the DO held by this BDO. * * @param rbdo CompanyBDO to be set to point to this BDO and committed. * @param tran The transaction to be used for the commit. If null, a new transaction is created. * @exception DatabaseManagerException if could not create a transaction * @exception java.sql.SQLException if any SQL errors occur. * @exception DataObjectException If object is not found in the database. */ public void addCompanyBDO(jobmatch.data.CompanyBDO rbdo, DBTransaction tran) throws SQLException, DatabaseManagerException, DataObjectException, RefAssertionException, DBRowUpdateException, QueryException { rbdo.setIndustry(this.DO); rbdo.commit(tran); }