📄 contact_gnsg8g__weblogic_cmp_rdbms.java
字号:
}
} finally { __WL_method_state = oldState; }
}
public java.lang.String ejbCreate(java.lang.String arg0, java.lang.String arg1, java.lang.String arg2)
throws javax.ejb.CreateException {
int oldState = __WL_method_state;
try {
__WL_method_state = STATE_EJB_CREATE;
__WL_initialize();
super.ejbCreate(arg0, arg1, arg2);
try {
return (java.lang.String)__WL_create();
} catch (javax.ejb.CreateException ce) {
System.out.println("throwing create exception.");
throw ce;
} catch (RuntimeException e) {
if (__WL_debug) System.out.println("throwing runtime exception");
throw e;
}
catch (Exception ex) {
if (__WL_debug) System.out.println("throwing ejbeception");
throw new PersistenceRuntimeException(ex);
}
} finally { __WL_method_state = oldState; }
}
private Object __WL_create() throws Exception {
if (__WL_verbose) {
System.out.println("Contact_gnsg8g__WebLogic_CMP_RDBMS.__WL_create");
}
java.sql.Connection __WL_con = null;
java.sql.PreparedStatement __WL_stmt = null;
java.lang.String __WL_pk = null;
try {
__WL_pk = this.last;
__WL_con = __WL_pm.getConnection();
if(__WL_verbose) {
System.out.println(
"Contact_gnsg8g__WebLogic_CMP_RDBMS.__WL_create() got connection " +
__WL_con);
}
String __WL_query =
"insert into contact (LAST, FIRST, EMAIL) values (?, ?, ?)";
if(__WL_verbose) {
System.out.println(
"Contact_gnsg8g__WebLogic_CMP_RDBMS.createMethodName() produced sqlString "
+ __WL_query);
}
__WL_stmt = __WL_con.prepareStatement(__WL_query);
// preparedStatementParamIndex reset.
if(!__WL_pm.setParamNull(__WL_stmt, 1, this.last, "last")) {
__WL_stmt.setString(1, this.last);
if (__WL_verbose) {
Debug.say("paramIdx :"+1+" binded with value :"+this.last);
}
}
if(!__WL_pm.setParamNull(__WL_stmt, 2, this.first, "first")) {
__WL_stmt.setString(2, this.first);
if (__WL_verbose) {
Debug.say("paramIdx :"+2+" binded with value :"+this.first);
}
}
if(!__WL_pm.setParamNull(__WL_stmt, 3, this.email, "email")) {
__WL_stmt.setString(3, this.email);
if (__WL_verbose) {
Debug.say("paramIdx :"+3+" binded with value :"+this.email);
}
}
int count = __WL_stmt.executeUpdate();
if (count != 1) {
Loggable l = EJBLogger.logbeanNotCreatedLoggable(__WL_pk.toString());
throw new java.lang.Exception(l.getMessage());
}
if (__WL_snapshots_enabled) __WL_take_snapshot();
return __WL_pk;
} catch (java.sql.SQLException se) {
//ejb wants a duplicate key exception if that was what happened
if(__WL_verbose) {
System.out.println("Contact_gnsg8g__WebLogic_CMP_RDBMS.__WL_create() "+
"checking for duplicate key " + __WL_con);
}
boolean exists = false;
try {
exists = __WL_exists(__WL_pk);
}
catch (Exception e) {
throw se;
}
if (exists) {
Loggable l = EJBLogger.logduplicateKeyFoundLoggable(__WL_pk.toString());
throw new javax.ejb.DuplicateKeyException(l.getMessage());
}
else {
throw se;
}
} finally {
__WL_pm.releaseResources(__WL_con, __WL_stmt, null);
}
}
public void ejbRemove() throws javax.ejb.RemoveException {
int oldState = __WL_method_state;
try {
__WL_method_state = STATE_EJB_REMOVE;
if (__WL_verbose) {
System.out.println("Contact_gnsg8g__WebLogic_CMP_RDBMS.ejbRemove " +
__WL_ctx.getPrimaryKey());
}
super.ejbRemove();
java.sql.Connection __WL_con = null;
java.sql.PreparedStatement __WL_stmt = null;
try {
__WL_initialize();
java.lang.String __WL_pk = (java.lang.String) __WL_ctx.getPrimaryKey();
__WL_con = __WL_pm.getConnection();
__WL_stmt = __WL_con.prepareStatement(
"delete from contact where LAST = ?");
// preparedStatementParamIndex reset.
if(!__WL_pm.setParamNull(__WL_stmt, 1, __WL_pk, "last")) {
__WL_stmt.setString(1, __WL_pk);
if (__WL_verbose) {
Debug.say("paramIdx :"+1+" binded with value :"+__WL_pk);
}
}
int i = __WL_stmt.executeUpdate();
if (i == 0) {
Loggable l = EJBLogger.lognoSuchEntityExceptionLoggable(__WL_pk.toString());
throw new NoSuchEntityException(l.getMessage());
}
} catch (RuntimeException e) {
if (__WL_debug) System.out.println("throwing runtime exception");
throw e;
}
catch (Exception ex) {
if (__WL_debug) System.out.println("throwing ejbeception");
throw new PersistenceRuntimeException(ex);
}
finally {
__WL_pm.releaseResources(__WL_con, __WL_stmt, null);
}
} finally {
__WL_method_state = oldState;
}
}
public void ejbLoad() {
int oldState = __WL_method_state;
try {
__WL_method_state = STATE_EJBLOAD;
__WL_initialize();
try {
if (__WL_verbose) {
Debug.say("Contact_gnsg8g__WebLogic_CMP_RDBMS.ejbLoad"
+ __WL_ctx.getPrimaryKey());
}
java.sql.Connection __WL_con = null;
java.sql.PreparedStatement __WL_stmt = null;
java.sql.ResultSet __WL_rs = null;
try {
java.lang.String __WL_pk = (java.lang.String) __WL_ctx.getPrimaryKey();
__WL_con = __WL_pm.getConnection();
int selectForUpdateVal = __WL_pm.getSelectForUpdateValue();
// http://bugs.beasys.com/CRView?CR=CR070260
//
// optimization.
switch(selectForUpdateVal) {
case DDConstants.SELECT_FOR_UPDATE_DISABLED:
__WL_stmt = __WL_con.prepareStatement("SELECT LAST, FIRST, EMAIL FROM contact WHERE LAST = ?");
break;
case DDConstants.SELECT_FOR_UPDATE:
__WL_stmt = __WL_con.prepareStatement("SELECT LAST, FIRST, EMAIL FROM contact WHERE LAST = ? FOR UPDATE");
break;
case DDConstants.SELECT_FOR_UPDATE_NO_WAIT:
__WL_stmt = __WL_con.prepareStatement("SELECT LAST, FIRST, EMAIL FROM contact WHERE LAST = ? FOR UPDATE NOWAIT");
break;
default:
throw new AssertionError(
"Unknown selectForUpdate type: '"+selectForUpdateVal+"'");
}
// preparedStatementParamIndex reset.
if(!__WL_pm.setParamNull(__WL_stmt, 1, __WL_pk, "last")) {
__WL_stmt.setString(1, __WL_pk);
if (__WL_verbose) {
Debug.say("paramIdx :"+1+" binded with value :"+__WL_pk);
}
}
__WL_rs = __WL_stmt.executeQuery();
if (__WL_rs.next()) {
this.last = (java.lang.String)__WL_rs.getString(1);
if (__WL_rs.wasNull()) { this.last = null; }
this.first = (java.lang.String)__WL_rs.getString(2);
if (__WL_rs.wasNull()) { this.first = null; }
this.email = (java.lang.String)__WL_rs.getString(3);
if (__WL_rs.wasNull()) { this.email = null; }
} else {
if(__WL_verbose) {
Debug.say("Contact_gnsg8g__WebLogic_CMP_RDBMS.ejbLoad could not "
+ " find primary key " + __WL_pk);
}
Loggable l = EJBLogger.lognoSuchEntityExceptionLoggable(__WL_pk.toString());
throw new NoSuchEntityException(l.getMessage());
}
} finally {
__WL_pm.releaseResources(__WL_con, __WL_stmt, __WL_rs);
}
} catch (RuntimeException e) {
if (__WL_debug) System.out.println("throwing runtime exception");
throw e;
}
catch (Exception ex) {
if (__WL_debug) System.out.println("throwing ejbeception");
throw new PersistenceRuntimeException(ex);
}
super.ejbLoad();
if (__WL_snapshots_enabled) __WL_take_snapshot();
} finally {
__WL_method_state = oldState;
}
}
public void ejbStore() {
int oldState = __WL_method_state;
try {
__WL_method_state = STATE_EJBSTORE;
if (__WL_verbose) {
System.out.println("Contact_gnsg8g__WebLogic_CMP_RDBMS.ejbStore "+
__WL_ctx.getPrimaryKey());
}
super.ejbStore();
String setString = __WL_determineSetString();
if (setString == null) {
// nothing to write back to the database
if (__WL_verbose) Debug.say("** Skipping database write for" +
"read-only transaction");
return;
}
if (__WL_updateable) {
if(__WL_verbose) {
Debug.say(
"Contact_gnsg8g__WebLogic_CMP_RDBMS.ejbStore: bean is updatable.");
}
java.sql.Connection __WL_con = null;
java.sql.PreparedStatement __WL_stmt = null;
try {
java.lang.String __WL_pk = (java.lang.String) __WL_ctx.getPrimaryKey();
String __WL_query = "UPDATE contact SET " +
setString +
" WHERE LAST = ?";
if(__WL_verbose) {
Debug.say("sql: " + __WL_query);
}
__WL_con = __WL_pm.getConnection();
__WL_stmt = __WL_con.prepareStatement(__WL_query);
int __WL_num = 1;
if((! __WL_snapshots_enabled) || __WL_modified[0]) {
if(!__WL_pm.setParamNull(__WL_stmt, __WL_num, first, "first")) {
__WL_stmt.setString(__WL_num, first);
if (__WL_verbose) {
Debug.say("paramIdx :"+__WL_num+" binded with value :"+first);
}
}
__WL_num++;
__WL_modified[0] = false;
}
if((! __WL_snapshots_enabled) || __WL_modified[1]) {
if(!__WL_pm.setParamNull(__WL_stmt, __WL_num, email, "email")) {
__WL_stmt.setString(__WL_num, email);
if (__WL_verbose) {
Debug.say("paramIdx :"+__WL_num+" binded with value :"+email);
}
}
__WL_num++;
__WL_modified[1] = false;
}
if(!__WL_pm.setParamNull(__WL_stmt, __WL_num, __WL_pk, "last")) {
__WL_stmt.setString(__WL_num, __WL_pk);
if (__WL_verbose) {
Debug.say("paramIdx :"+__WL_num+" binded with value :"+__WL_pk);
}
}
__WL_num++;
int __WL_i = __WL_stmt.executeUpdate();
if (__WL_i == 0) {
Loggable l = EJBLogger.lognoSuchEntityExceptionLoggable(__WL_pk.toString());
throw new NoSuchEntityException(l.getMessage());
}
} catch (RuntimeException e) {
if (__WL_debug) System.out.println("throwing runtime exception");
throw e;
}
catch (Exception ex) {
if (__WL_debug) System.out.println("throwing ejbeception");
throw new PersistenceRuntimeException(ex);
}
finally {
try {
if (__WL_stmt != null) __WL_stmt.close();
__WL_pm.releaseConnection (__WL_con);
} catch (java.lang.Exception e) {
if (__WL_debug) e.printStackTrace();
throw new EJBException(e);
}
}
}
} finally {
__WL_method_state = oldState;
}
}
// end javax.ejb.EntityBean
//=================================================================
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -