/** * Method to do deletes. This method is to be used during a transaction, otherwise use the * doDelete(Criteria) method. It will take care of the connection details internally. * * @param criteria object containing data that is used DELETE from database. * @param con the connection to use * @throws TorqueException Any exceptions caught during processing will be rethrown wrapped into a * TorqueException. */ public static void doDelete(Criteria criteria, Connection con) throws TorqueException { correctBooleans(criteria); setDbName(criteria); if (con == null) { BasePeer.doDelete(criteria, TABLE_NAME); } else { BasePeer.doDelete(criteria, TABLE_NAME, con); } }
/** * Method to do inserts. This method is to be used during a transaction, otherwise use the * doInsert(Criteria) method. It will take care of the connection details internally. * * @param criteria object used to create the INSERT statement. * @param con the connection to use * @throws TorqueException Any exceptions caught during processing will be rethrown wrapped into a * TorqueException. */ public static ObjectKey doInsert(Criteria criteria, Connection con) throws TorqueException { correctBooleans(criteria); setDbName(criteria); if (con == null) { return BasePeer.doInsert(criteria); } else { return BasePeer.doInsert(criteria, con); } }
/** * Method to do updates. This method is to be used during a transaction, otherwise use the * doUpdate(Criteria) method. It will take care of the connection details internally. * * @param criteria object containing data that is used to create the UPDATE statement. * @param con the connection to use * @throws TorqueException Any exceptions caught during processing will be rethrown wrapped into a * TorqueException. */ public static void doUpdate(Criteria criteria, Connection con) throws TorqueException { Criteria selectCriteria = new Criteria(DATABASE_NAME, 2); correctBooleans(criteria); selectCriteria.put(OBJECTID, criteria.remove(OBJECTID)); setDbName(criteria); if (con == null) { BasePeer.doUpdate(selectCriteria, criteria); } else { BasePeer.doUpdate(selectCriteria, criteria, con); } }
/** * selects a collection of TScreenTab objects pre-filled with their TScreen objects. * * <p>This method is protected by default in order to keep the public api reasonable. You can * provide public methods for those you actually need in TScreenTabPeer. * * @throws TorqueException Any exceptions caught during processing will be rethrown wrapped into a * TorqueException. */ protected static List<TScreenTab> doSelectJoinTScreen(Criteria criteria, Connection conn) throws TorqueException { setDbName(criteria); TScreenTabPeer.addSelectColumns(criteria); int offset = numColumns + 1; TScreenPeer.addSelectColumns(criteria); criteria.addJoin(TScreenTabPeer.PARENT, TScreenPeer.OBJECTID); correctBooleans(criteria); List<Record> rows; if (conn == null) { rows = BasePeer.doSelect(criteria); } else { rows = BasePeer.doSelect(criteria, conn); } List<TScreenTab> results = new ArrayList<TScreenTab>(); for (int i = 0; i < rows.size(); i++) { Record row = rows.get(i); Class omClass = TScreenTabPeer.getOMClass(); TScreenTab obj1 = (TScreenTab) TScreenTabPeer.row2Object(row, 1, omClass); omClass = TScreenPeer.getOMClass(); TScreen obj2 = (TScreen) TScreenPeer.row2Object(row, offset, omClass); boolean newObject = true; for (int j = 0; j < results.size(); j++) { TScreenTab temp_obj1 = results.get(j); TScreen temp_obj2 = (TScreen) temp_obj1.getTScreen(); if (temp_obj2.getPrimaryKey().equals(obj2.getPrimaryKey())) { newObject = false; temp_obj2.addTScreenTab(obj1); break; } } if (newObject) { obj2.initTScreenTabs(); obj2.addTScreenTab(obj1); } results.add(obj1); } return results; }
/** * Grabs the raw Village records to be formed into objects. This method should be used for * transactions * * @param criteria object used to create the SELECT statement. * @param con the connection to use * @throws TorqueException Any exceptions caught during processing will be rethrown wrapped into a * TorqueException. */ public static List<Record> doSelectVillageRecords(Criteria criteria, Connection con) throws TorqueException { if (criteria.getSelectColumns().size() == 0) { addSelectColumns(criteria); } correctBooleans(criteria); setDbName(criteria); // BasePeer returns a List of Value (Village) arrays. The array // order follows the order columns were placed in the Select clause. if (con == null) { return BasePeer.doSelect(criteria); } else { return BasePeer.doSelect(criteria, con); } }
/** * changes the boolean values in the criteria to the appropriate type, whenever a booleanchar or * booleanint column is involved. This enables the user to create criteria using Boolean values * for booleanchar or booleanint columns * * @param criteria the criteria in which the boolean values should be corrected * @throws TorqueException if the database map for the criteria cannot be obtained. */ public static void correctBooleans(Criteria criteria) throws TorqueException { correctBooleans(criteria, getTableMap()); }