Methods Summary |
---|
public void | ejbActivate()
|
public java.lang.Integer | ejbCreateAddress(java.lang.String street, java.lang.String city, java.lang.String state, java.lang.String zip)
setStreet(street);
setCity(city);
setState(state);
setZip(zip);
setId(getNextUniqueKey());
return null;
|
public void | ejbLoad()
|
public void | ejbPassivate()
|
public void | ejbPostCreateAddress(java.lang.String street, java.lang.String city, java.lang.String state, java.lang.String zip)
|
public void | ejbRemove()
|
public void | ejbStore()
|
public abstract java.lang.String | getCity()
|
public abstract java.lang.Integer | getId()
|
private java.lang.Integer | getNextUniqueKey()
Connection conn = null;
Statement stmt = null;
ResultSet rs = null;
Statement stmt2 = 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("'Address'");//.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);
System.out.println("ID fetched =="+ myId.intValue());
sequenceID++;
stmt2 = conn.createStatement();
StringBuffer aString2 = new StringBuffer("update \"SequenceTable\" set \"CurrentValue\"="+sequenceID+" where \"SequenceName\"='Address'");
System.out.println(aString2);
stmt2.execute(aString2.toString());
}
catch( Exception ex)
{
ex.printStackTrace();
}
finally
{
try
{
stmt.close();
stmt2.close();
conn.close();
}
catch( Exception ex)
{
ex.printStackTrace();
}
}
return myId;
|
public abstract java.lang.String | getState()
|
public abstract java.lang.String | getStreet()
|
public abstract java.lang.String | getZip()
|
public abstract void | setCity(java.lang.String city)
|
public void | setEntityContext(javax.ejb.EntityContext ec)
|
public abstract void | setId(java.lang.Integer id)
|
public abstract void | setState(java.lang.String state)
|
public abstract void | setStreet(java.lang.String street)
|
public abstract void | setZip(java.lang.String zip)
|
public void | unsetEntityContext()
|