Пример #1
0
 private EntityId fetchEntityId(Connection con, String tt, Integer uid) throws SQLException {
   Statement st = null;
   ResultSet rs = null;
   try {
     st = con.createStatement();
     rs =
         st.executeQuery(
             "SELECT "
                 + tt.toLowerCase()
                 + "entity_entity_id FROM "
                 + tt
                 + "Entity WHERE "
                 + tt.toLowerCase()
                 + "entity_"
                 + tt.toLowerCase()
                 + "_id="
                 + uid);
     if (rs.next()) {
       return EntityId.valueOf(rs.getInt(1));
     }
     return null;
   } finally {
     cleanup(null, st, rs);
   }
 }
Пример #2
0
 /** Allocate a new entity id in the obm 2.2 entity table */
 private EntityId allocateEntityId(Connection con) throws SQLException {
   Statement st = null;
   try {
     st = con.createStatement();
     st.executeUpdate("insert into Entity (entity_mailing) values (TRUE)");
   } finally {
     cleanup(null, st, null);
   }
   return EntityId.valueOf(lastInsertId(con));
 }