?? wbrole_wjvqb2__weblogic_cmp_rdbms_wbemployee_set.java
字號:
/**
* This code was automatically generated at 15:51:48 on 2005-12-9
* by weblogic.ejb20.cmp.rdbms.codegen.ManyToManyGenerator -- do not edit.
*
* @version WebLogic Server 8.1 Fri Dec 5 15:01:51 PST 2003 316284
* @author Copyright (c) 2005 by BEA Systems, Inc. All Rights Reserved.
*/
package custom_management;
import javax.transaction.Transaction;
import javax.transaction.TransactionManager;
import java.util.Collection;
import java.util.List;
import java.util.ArrayList;
import java.util.Set;
import java.util.HashSet;
import java.util.Iterator;
import java.lang.reflect.Method;
import java.lang.reflect.Array;
import java.io.Serializable;
import java.io.IOException;
import javax.ejb.EJBObject;
import javax.ejb.EJBLocalObject;
import javax.ejb.EntityContext;
import javax.ejb.EJBException;
import javax.ejb.NoSuchEntityException;
import weblogic.ejb20.dd.DDConstants;
import weblogic.ejb20.interfaces.WLEnterpriseBean;
import weblogic.ejb20.persistence.spi.CMPBeanManager;
import weblogic.ejb20.persistence.spi.EoWrapper;
import weblogic.ejb20.persistence.spi.EloWrapper;
import weblogic.ejb20.persistence.spi.PersistenceRuntimeException;
import weblogic.ejb20.cmp.rdbms.RDBMSException;
import weblogic.ejb20.cmp.rdbms.RDBMSM2NSet;
import weblogic.ejb20.cmp.rdbms.RDBMSSet;
import weblogic.ejb20.cmp.rdbms.RDBMSPersistenceManager;
import weblogic.ejb20.cmp.rdbms.RDBMSUtils;
import weblogic.ejb20.EJBTextTextFormatter;
import weblogic.ejb20.EJBLogger;
import weblogic.logging.Loggable;
import weblogic.transaction.TransactionHelper;
import weblogic.utils.Debug;
public final class WbRole_wjvqb2__WebLogic_CMP_RDBMS_wbEmployee_Set implements RDBMSM2NSet, Set, Serializable,Cloneable {
// =================================================================
// Class variable(s)
private static final boolean __WL_debug =
(System.getProperty(RDBMSUtils.RDBMS_CODEGEN_DEBUG_PROP) != null);
private static final boolean __WL_verbose =
(System.getProperty(RDBMSUtils.RDBMS_CODEGEN_VERBOSE_PROP) != null);
private CMPBeanManager __WL_bm; // bean manager of the related target bean in this collection
private RDBMSPersistenceManager __WL_pm; // persistence manager of the bean that owns this collection
private custom_management.WbRole_wjvqb2_Intf __WL_creator;
private Method __WL_finder;
private Object __WL_createPk;
private EJBLocalObject __WL_createEo;
private Collection __WL_cache;
private boolean __WL_symmetric = false;
private boolean orderDatabaseOperations = false;// if this is 'True', then we defer all Join Table INSERTs
// to COMMIT time, we do *not* INSERT them here in this Set.
private Set __WL_addSet = null;;
private Transaction tx;
private Transaction __WL_createTx;
private boolean isCreatorBeanInvalidated = false;
public WbRole_wjvqb2__WebLogic_CMP_RDBMS_wbEmployee_Set(custom_management.WbRole_wjvqb2_Intf __WL_creator,
CMPBeanManager __WL_bm,
Method __WL_finder,
RDBMSPersistenceManager __WL_pm)
{
if (__WL_verbose) Debug.say("WbRole_wjvqb2__WebLogic_CMP_RDBMS_wbEmployee_Set() called.");
try {
this.__WL_bm = __WL_bm;
this.__WL_pm = __WL_pm;
this.__WL_creator = __WL_creator;
this.__WL_finder = __WL_finder;
EntityContext __WL_ctx = __WL_creator.__WL_getEntityContext();
__WL_createPk = __WL_ctx.getPrimaryKey();
__WL_createEo = __WL_ctx.getEJBLocalObject();
__WL_createTx = TransactionHelper.getTransactionHelper().getTransaction();
orderDatabaseOperations = __WL_pm.getOrderDatabaseOperations();
} catch (RuntimeException re) {
if (__WL_verbose) {
Debug.say("rethrowing RuntimeException.");
re.printStackTrace();
}
throw re;
} catch (Exception ex) {
if (__WL_verbose) {
Debug.say("wrapping Exception in PersistenceRuntimeException.");
ex.printStackTrace();
}
throw new PersistenceRuntimeException(ex);
}
}
private void populateCache()
{
if (__WL_verbose) Debug.say("populateCache() called.");
try {
if (__WL_debug) {
Debug.assertion(__WL_createPk !=null);
}
if (__WL_verbose) {
Debug.say("calling localWrapperSetFinder with pk: " + __WL_createPk);
}
isCreatorBeanInvalidated = false;
__WL_cache = __WL_bm.localWrapperSetFinder(__WL_finder, new Object[] {__WL_createPk});
if (orderDatabaseOperations) {
// add any cached ADDs to the __WL_cache
if (__WL_addSet != null) {
Set s = getAddSet();
Iterator it = s.iterator();
while (it.hasNext()) {
Object otherPK = it.next();
if (__WL_verbose)
Debug.say("WbRole_wjvqb2__WebLogic_CMP_RDBMS_wbEmployee_Set: adding from AddSet to __WL_cache: "+
"Join Table INSERT pk '"+otherPK+"'");
Object eo = __WL_bm.finderGetEoFromBeanOrPk(null, otherPK, true);
doAdd(eo);
}
}
}
} catch (RuntimeException re) {
if (__WL_verbose) {
Debug.say("rethrowing RuntimeException.");
re.printStackTrace();
}
throw re;
} catch (Exception ex) {
if (__WL_verbose) {
Debug.say("wrapping Exception in PersistenceRuntimeException.");
ex.printStackTrace();
}
throw new PersistenceRuntimeException(ex);
}
}
//======================================================================
//implementation of RDBMSM2NSet
public Object getCreatorPk() {
return __WL_createPk;
}
public void doAdd(Object o) {
if (__WL_verbose) Debug.say("doAdd() called.");
EJBLocalObject eo = (EJBLocalObject)o;
checkTransaction();
EloWrapper wrap = new EloWrapper(eo);
if (__WL_cache !=null) {
if (__WL_verbose) {
Debug.say("doAdd() adding to cached collection.");
}
if (__WL_debug) {
Debug.assertion(!__WL_cache.contains(wrap));
}
__WL_cache.add(wrap);
}
if(!isCreatorBeanInvalidated) {
__WL_pm.registerInvalidatedBean(__WL_createPk);
isCreatorBeanInvalidated = true;
}
}
public void doRemove(Object o) {
doRemove(o, true);
}
public void doRemove(Object o, boolean remove) {
if (__WL_verbose) Debug.say("doRemove() called.");
EJBLocalObject eo = (EJBLocalObject)o;
checkTransaction();
EloWrapper wrap = new EloWrapper(eo);
if (__WL_cache !=null) {
if (remove) {
if (__WL_debug) {
Debug.assertion(__WL_cache.contains(wrap));
}
if (__WL_verbose) {
Debug.say("doRemove() removing from cached collection.");
}
__WL_cache.remove(wrap);
}
}
if(!isCreatorBeanInvalidated) {
__WL_pm.registerInvalidatedBean(__WL_createPk);
isCreatorBeanInvalidated = true;
}
}
public void doAddToCache(Object o) { } // not used here. Used in One To Many Set only
public Set getAddSet() {
if (__WL_addSet != null) {
return __WL_addSet;
}
__WL_addSet = new HashSet();
return __WL_addSet;
}
//======================================================================
//======================================================================
//implementation of java.util.Collection
public Iterator iterator() {
if (__WL_verbose) Debug.say("iterator() called.");
checkTransaction();
if (__WL_cache==null) {
populateCache();
}
return new WbRole_wjvqb2__WebLogic_CMP_RDBMS_wbEmployee_Iterator(__WL_cache.iterator(), this);
}
private boolean existsJoinTable(Object __WL_pk1, Object __WL_pk2) {
if (__WL_verbose) Debug.say("existsJoinTable() called. "
+ "(" + __WL_pk1 + ", " + __WL_pk2 + ")");
java.sql.Connection __WL_con = null;
java.sql.PreparedStatement __WL_stmt = null;
java.sql.ResultSet __WL_rs = null;
int selectForUpdateVal = __WL_pm.getSelectForUpdateValue();
java.lang.String __WL_query = null;
switch(selectForUpdateVal) {
case DDConstants.SELECT_FOR_UPDATE_DISABLED:
__WL_query = "SELECT 7 FROM Wb_Employee_Role WHERE (role_uid = ?) AND (employee_uid = ?)";
break;
case DDConstants.SELECT_FOR_UPDATE:
__WL_query = "SELECT 7 FROM Wb_Employee_Role WHERE (role_uid = ?) AND (employee_uid = ?) FOR UPDATE ";
break;
case DDConstants.SELECT_FOR_UPDATE_NO_WAIT:
__WL_query = "SELECT 7 FROM Wb_Employee_Role WHERE (role_uid = ?) AND (employee_uid = ?) FOR UPDATE NOWAIT ";
break;
default:
throw new AssertionError(
"Unknown selectForUpdate type: '"+selectForUpdateVal+"'");
}
try {
__WL_con = __WL_pm.getConnection();
__WL_stmt = __WL_con.prepareStatement(__WL_query);
__WL_stmt.setLong(1, ((java.lang.Long)__WL_pk1).longValue());
__WL_stmt.setLong(2, ((java.lang.Long)__WL_pk2).longValue());
__WL_rs = __WL_stmt.executeQuery();
if (__WL_rs.next()) {
if (__WL_verbose) {
System.out.println("WbRole_wjvqb2__WebLogic_CMP_RDBMS_wbEmployee_Set.existsJoinTable "
+ "found relation: " + "(" + __WL_pk1 + ", " + __WL_pk2 + ")");
}
return true;
} else {
if (__WL_verbose) {
System.out.println("WbRole_wjvqb2__WebLogic_CMP_RDBMS_wbEmployee_Set.existsJoinTable could not "
+ "find relation: " + "(" + __WL_pk1 + ", " + __WL_pk2 + ")");
}
return false;
}
} catch (RuntimeException re) {
if (__WL_verbose) {
Debug.say("rethrowing RuntimeException.");
re.printStackTrace();
}
throw re;
} catch (Exception ex) {
if (__WL_verbose) {
Debug.say("wrapping Exception in PersistenceRuntimeException.");
ex.printStackTrace();
}
throw new PersistenceRuntimeException(ex);
}
finally {
__WL_pm.releaseResources(__WL_con, __WL_stmt, __WL_rs);
}
}
private boolean addJoinTable(Object __WL_pk1, Object __WL_pk2)
throws java.sql.SQLException
{
if (__WL_verbose) Debug.say("addJoinTable() called.");
java.sql.Connection __WL_con = null;
java.sql.PreparedStatement __WL_stmt = null;
try {
__WL_con = __WL_pm.getConnection();
String __WL_query = getAddJoinTableSQL();
if (__WL_verbose) {
Debug.say("WbRole_wjvqb2__WebLogic_CMP_RDBMS_wbEmployee_Set.addJoinTable() " +
"produced sqlString: " + __WL_query);
}
__WL_stmt = __WL_con.prepareStatement(__WL_query);
setAddJoinTableSQLParams(__WL_stmt,
__WL_pk1,
__WL_pk2);
int effected = __WL_stmt.executeUpdate();
if (effected != 1) {
Loggable l = EJBLogger.logerrorInsertingInJoinTableLoggable
(__WL_pk1.toString(),__WL_pk2.toString(),Integer.toString(effected),"Wb_Employee_Role");
throw new EJBException(l.getMessage());
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -