Java Reference
In-Depth Information
{
conn = getConnection();
ps = conn.prepareStatement( "select state from workflows " +
" where clientid = ?" );
ps.setString( 1, clientID );
ps.executeQuery();
ResultSet rs = ps.getResultSet();
if( rs.next() )
{
state = rs.getInt( 1 );
installEJBMBean();
}
else
{
throw new NoSuchEntityException( "Could not find data"); }
}
catch ( Exception e )
{
throw new EJBException( e );
}
finally
{
cleanup( conn, ps );
}
}
public void ejbStore()
{
Connection conn = null;
PreparedStatement ps = null;
try
{
conn = getConnection();
ps =
conn.prepareStatement( "update workflows set state = ? " +
" where clientID = ?" );
ps.setInt( 1, state );
ps.setString( 2, clientID );
ps.executeUpdate();
}
catch( Exception e )
{
throw new EJBException ( e );
}
finally
{
cleanup( conn, ps );
}
}
Search WWH ::




Custom Search