Java Reference
In-Depth Information
public String ejbCreate( String clientID ) throws CreateException
{
this.clientID = clientID;
Connection conn = null;
PreparedStatement ps = null;
try
{
conn = getConnection();
ps = conn.prepareStatement( "insert into workflows " +
" ( clientID, state ) values ( ?, ? )" );
ps.setString( 1, clientID );
ps.setInt( 2, 0 );
ps.executeUpdate();
return clientID;
}
catch ( Exception e )
{
e.printStackTrace();
throw new CreateException( "Error, possible duplicate Key" );
}
finally
{
cleanup( conn, ps );
}
}
public void ejbPostCreate( String clientID)
{
System.out.println( "Post create called" );
}
D
Remove EJB
public void ejbRemove()
{
Connection conn = null;
PreparedStatement ps = null;
try
{
removeEJBMBean();
conn = getConnection();
clientID = ( String ) ctx.getPrimaryKey();
ps = conn.prepareStatement( "delete from workflows where " +
"clientID = ?" );
ps.setString( 1, clientID );
ps.executeUpdate();
}
catch ( Exception e )
{
throw new EJBException ( e );
}
Search WWH ::




Custom Search