O'Reilly logo

Java Data Objects by Craig Russell, David Jordan

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

The com.mediamania.appserver package

This package includes classes that are described in Chapter 16 and Chapter 17 for using JDO in an application server environment.

com.mediamania.appserver.CashierBean

 1 package com.mediamania.appserver; 2 3 import javax.ejb.*; 4 5 import javax.naming.InitialContext; 6 import javax.naming.Context; 7 import javax.naming.NamingException; 8 9 import java.util.Iterator; 10 import java.util.Date; 11 12 import com.mediamania.store.StoreQueries; 13 import com.mediamania.store.Customer; 14 import com.mediamania.store.Purchase; 15 import com.mediamania.store.Rental; 16 import com.mediamania.store.RentalItem; 17 import com.mediamania.store.MediaItem; 18 19 import javax.jdo.PersistenceManager; 20 import javax.jdo.PersistenceManagerFactory; 21 22 public class CashierBean implements javax.ejb.SessionBean { 23 private javax.ejb.SessionContext context; 24 private PersistenceManagerFactory pmf; 25 private PersistenceManager pm; 26 private String pmfName = "java:comp/env/jdo/MediaManiaPMF"; 27 28 /** 29 * @see javax.ejb.SessionBean#setSessionContext(javax.ejb.SessionContext) 30 */ 31 public void setSessionContext(javax.ejb.SessionContext aContext) { 32 context = aContext; 33 try { 34 Context ic = new InitialContext( ); 35 pmf = (PersistenceManagerFactory)ic.lookup(pmfName); 36 } catch (NamingException ex) { 37 throw new EJBException("setSessionContext", ex); 38 } 39 } 40 41 public void ejbActivate( ) { 42 } 43 public void ejbPassivate( ) { 44 } 45 public void ejbRemove( ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required