{
try
{
InitialContext ctx = new InitialContext();
Context enc = (Context) ctx.lookup("java:comp/env");
LocalCheckBookHome home = (LocalCheckBookHome) enc.lookup("ejb/LocalCheckBookHome");
try
{
checkBook = home.findByPrimaryKey(account);
}
catch(FinderException e)
{
log.info("Failed to find CheckBook for: "+account);
checkBook = home.create(account, balance);
// Populate the check book
LocalCheckBookEntryHome home2 = (LocalCheckBookEntryHome) enc.lookup("ejb/LocalCheckBookEntryHome");
populateCheckBook(home2);
}
}