?? wbrole_wjvqb2__weblogic_cmp_rdbms_wbemployee_set.java
字號:
}
return true;
} catch (java.sql.SQLException se) {
if(__WL_verbose) {
Debug.say("WbRole_wjvqb2__WebLogic_CMP_RDBMS_wbEmployee_Set.addJoinTable() "+
"checking for duplicate key " + __WL_con);
}
try {
boolean exists = existsJoinTable(__WL_pk1, __WL_pk2);
if (exists) return false;
throw se;
} catch (Exception ex) {
if (__WL_verbose) {
Debug.say("Exception during existsJoinTable is being ignored.");
ex.printStackTrace();
}
throw se;
}
} finally {
__WL_pm.releaseResources(__WL_con, __WL_stmt, null);
}
}
public String getAddJoinTableSQL()
{
return "INSERT INTO Wb_Employee_Role (role_uid, employee_uid) VALUES (?, ?)";
}
public void setAddJoinTableSQLParams(java.sql.PreparedStatement __WL_stmt,
Object __WL_pk1,
Object __WL_pk2)
throws java.sql.SQLException
{
__WL_stmt.setLong(1, ((java.lang.Long)__WL_pk1).longValue());
__WL_stmt.setLong(2, ((java.lang.Long)__WL_pk2).longValue());
}
public Transaction getTransaction() { return __WL_createTx; }
public void setTransaction(Transaction newCreateTx) {
__WL_createTx = newCreateTx;
}
public boolean add(Object o)
{
if (__WL_verbose) Debug.say("add() called.");
checkTransaction();
if (o==null)
throw new IllegalArgumentException();
if (!(o instanceof custom_management.WbEmployee))
throw new IllegalArgumentException(
"Attempted to add an object of type '" +
o.getClass().getName() +
"' to collection, but the type must be '" +
"custom_management.WbEmployee' instead.");
try {
EJBLocalObject eo = (EJBLocalObject)o;
custom_management.WbEmployee_ji9hxe_Intf __WL_bean = (custom_management.WbEmployee_ji9hxe_Intf)
__WL_bm.lookup(eo.getPrimaryKey());
try {
__WL_bean.__WL_checkExistsOnMethod();
}
catch (NoSuchEntityException nsee) {
throw new IllegalArgumentException(
"Instance of EJB 'WbEmployee' with primary key '" +
eo.getPrimaryKey() +
"' does not exist.");
}
boolean changed = false;
Object otherPK = null;
if (orderDatabaseOperations) {
// do add check for deferred Join Table INSERTs
otherPK = eo.getPrimaryKey();
boolean contains = getAddSet().contains(otherPK);
if (contains) {
if (__WL_verbose)
Debug.say("WbRole_wjvqb2__WebLogic_CMP_RDBMS_wbEmployee_Set: add: skipping JoinTable check, "+
"addSet already contains cached Join Table INSERT pk '"+otherPK+"'");
return false; // this PK already added, exit false
}
boolean exists = false;
exists = existsJoinTable(__WL_createPk, eo.getPrimaryKey());
if (exists) {
return false; // this PK already in Join Table, exit false
}
changed = (!exists);
}
else {
// do add check for non-deferred Join Table INSERTs
changed = addJoinTable(__WL_createPk, eo.getPrimaryKey());
if (__WL_symmetric) {
if (!__WL_createPk.equals(eo.getPrimaryKey())) {
addJoinTable(eo.getPrimaryKey(), __WL_createPk);
}
}
}
if (changed) {
if (orderDatabaseOperations) {
// add to Bulk Add Set
if (__WL_verbose) {
Debug.say("adding pk '"+otherPK+"' to addSet");
}
addToAddSet(otherPK);
}
doAdd(eo);
int oldState = __WL_bean.__WL_getMethodState();
try {
__WL_bean.__WL_setMethodState(WLEnterpriseBean.STATE_BUSINESS_METHOD);
RDBMSM2NSet __WL_collection = (RDBMSM2NSet)
__WL_bean.getWbRole();
__WL_collection.doAdd(__WL_createEo);
if (orderDatabaseOperations) {
// add the PK of this side of M-N relation to the
// deferred addSet of the other side of the M-N relation.
__WL_collection.addToAddSet(__WL_createPk);
}
} finally {
__WL_bean.__WL_setMethodState(oldState);
}
}
return changed;
} 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);
}
}
public boolean addAll(Collection __WL_collection) {
if (__WL_verbose) Debug.say("addAll() called.");
checkTransaction();
if (__WL_collection==null) return false;
Iterator __WL_iter = __WL_collection.iterator();
boolean changed = false;
while (__WL_iter.hasNext()) {
changed |= add(__WL_iter.next());
}
return changed;
}
public void addToAddSet(Object pk)
{
if (__WL_verbose)
Debug.say("WbRole_wjvqb2__WebLogic_CMP_RDBMS_wbEmployee_Set: addToAddSet: creator pk '"+__WL_createPk+
"' adding to cached Join Table Insert pk '"+pk+"'");
getAddSet().add(pk);
__WL_pm.registerM2NJoinTableInsert("wbEmployee", __WL_createPk);
}
public void clear() {
if (__WL_verbose) Debug.say("clear() called.");
checkTransaction();
if (__WL_cache==null) {
populateCache();
}
Collection cln = (Collection)((HashSet)__WL_cache).clone();
Iterator __WL_iter = cln.iterator();
while (__WL_iter.hasNext()) {
EloWrapper __WL_wrapper = (EloWrapper)__WL_iter.next();
remove(__WL_wrapper.getEJBLocalObject());
}
}
public boolean contains(Object o)
{
if (__WL_verbose) Debug.say("contains() called.");
checkTransaction();
if (o==null) throw new IllegalArgumentException();
try {
EJBLocalObject eo = (EJBLocalObject)o;
custom_management.WbEmployee_ji9hxe_Intf __WL_bean = (custom_management.WbEmployee_ji9hxe_Intf)
__WL_bm.lookup(eo.getPrimaryKey());
try {
__WL_bean.__WL_checkExistsOnMethod();
}
catch (NoSuchEntityException nsee) {
Loggable l = EJBLogger.logbeanDoesNotExistLoggable("WbEmployee",eo.getPrimaryKey().toString());
throw new IllegalArgumentException(l.getMessage());
}
if (__WL_cache !=null) {
EloWrapper wrap = new EloWrapper(eo);
return __WL_cache.contains(wrap);
}
// we may have a deferred the INSERT of this bean
if (orderDatabaseOperations) {
if (getAddSet().contains(eo.getPrimaryKey())) {
return true;
}
}
return existsJoinTable(__WL_createPk, eo.getPrimaryKey());
} 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);
}
}
public boolean containsAll(Collection eos)
{
if (__WL_verbose) Debug.say("containsAll() called.");
checkTransaction();
if (eos==null) return true;
Iterator iter = eos.iterator();
while (iter.hasNext()) {
if (!contains(iter.next())) {
return false;
}
}
return true;
}
public boolean equals(Object o)
{
if (__WL_verbose) Debug.say("equals() called.");
checkTransaction();
if (!(o instanceof WbRole_wjvqb2__WebLogic_CMP_RDBMS_wbEmployee_Set))
return false;
WbRole_wjvqb2__WebLogic_CMP_RDBMS_wbEmployee_Set other = (WbRole_wjvqb2__WebLogic_CMP_RDBMS_wbEmployee_Set)o;
if (__WL_cache==null)
populateCache();
if (other.__WL_cache==null)
other.populateCache();
return __WL_cache.equals(other.__WL_cache);
}
public int hashCode()
{
if (__WL_verbose) Debug.say("hashCode() called.");
checkTransaction();
if (__WL_cache==null)
populateCache();
return __WL_cache.hashCode();
}
public boolean isEmpty()
{
if (__WL_verbose) Debug.say("isEmpty() called.");
checkTransaction();
if (__WL_cache==null)
populateCache();
return __WL_cache.isEmpty();
}
private boolean removeJoinTable(Object __WL_pk1, Object __WL_pk2)
{
if (__WL_verbose) Debug.say("removeJoinTable() called.");
java.sql.Connection __WL_con = null;
java.sql.PreparedStatement __WL_stmt = null;
try {
__WL_con = __WL_pm.getConnection();
String __WL_query = "delete from Wb_Employee_Role where (role_uid = ?) AND (employee_uid = ?)";
if (__WL_verbose) {
Debug.say("WbRole_wjvqb2__WebLogic_CMP_RDBMS_wbEmployee_Set.removeJoinTable() " +
"produced sqlString: " + __WL_query);
}
__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());
if (__WL_stmt.executeUpdate() != 1) {
return false;
}
else {
return true;
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -