Methods Summary |
---|
public void | ejbActivate()
|
public java.lang.Object | ejbCreate(java.sql.Date exp, java.lang.String numb, java.lang.String name, java.lang.String org)
System.out.println("ejbCreate");
setId( getNextUniqueKey() );
setExpirationDate(exp);
setNumber(numb);
setNameOnCard(name);
setCreditOrganization(org);
return null;
|
public void | ejbLoad()
|
public void | ejbPassivate()
|
public void | ejbPostCreate(java.sql.Date exp, java.lang.String numb, java.lang.String name, java.lang.String org)
System.out.println("ejbPostCreate");
|
public void | ejbRemove()
|
public void | ejbStore()
|
public abstract java.lang.String | getCreditOrganization()
|
public abstract CustomerLocal | getCustomer()
|
public abstract java.sql.Date | getExpirationDate()
|
public abstract java.lang.Integer | getId()
|
public abstract java.lang.String | getNameOnCard()
|
private java.lang.Integer | getNextUniqueKey()
Connection conn = null;
Statement stmt = null;
Statement stmt2 = null;
ResultSet rs = null;
boolean rowspresent = false;
int sequenceID = 0;
Integer myId = null;
try
{
InitialContext aContext = new InitialContext();
javax.sql.DataSource aDatasource = (javax.sql.DataSource)aContext.lookup("jdbc/TitanUID");
conn = aDatasource.getConnection();
System.out.println("Obtained a database connection to Cloudscape");
stmt = conn.createStatement();
StringBuffer aString = new StringBuffer();
aString.append("select ").append("\"").append("CurrentValue");
aString.append("\"").append(" from ").append("\"").append("SequenceTable");
aString.append("\"").append(" where").append("\"").append("SequenceName");
aString.append("\"").append("like").append("'CreditCard'"); //.append(" for Update");
System.out.println(aString);
rs = stmt.executeQuery(aString.toString());
if (rs != null)
{
while (rs.next())
{
sequenceID =rs.getInt(1);
}
}
myId = new Integer(sequenceID);
sequenceID++;
StringBuffer aString2 = new StringBuffer("update \"SequenceTable\" set \"CurrentValue\"="+sequenceID+" where \"SequenceName\"='CreditCard'");
stmt2 = conn.createStatement();
System.out.println(aString2);
stmt2.execute(aString2.toString());
}
catch( Exception ex)
{
System.out.println("In the catch clause of CreditCardBean");
ex.printStackTrace();
}
finally
{
try
{
stmt.close();
stmt2.close();
conn.close();
}
catch( Exception ex)
{
System.out.println("In the catch clause of finally section of CreditCardBean");
ex.printStackTrace();
}
}
return myId;
|
public abstract java.lang.String | getNumber()
|
public abstract void | setCreditOrganization(java.lang.String org)
|
public abstract void | setCustomer(CustomerLocal cust)
|
public void | setEntityContext(javax.ejb.EntityContext ec)
|
public abstract void | setExpirationDate(java.sql.Date date)
|
public abstract void | setId(java.lang.Integer id)
|
public abstract void | setNameOnCard(java.lang.String name)
|
public abstract void | setNumber(java.lang.String number)
|
public void | unsetEntityContext()
|