Returns all the {@link xpetstore.web.cart.CartItem}s
Session s = null;
Map cart = getCart( );
try
{
if ( _cartItems == null )
{
_cartItems = new ArrayList( );
if ( cart.size( ) > 0 )
{
s = getHibernateSession( );
Iterator it = cart.keySet( ).iterator( );
while ( it.hasNext( ) )
{
String itemId = ( String ) it.next( );
Integer quantity = ( Integer ) cart.get( itemId );
Item item = ( Item ) s.load( Item.class, itemId );
_cartItems.add( new OrderItem( item, quantity.intValue( ) ) );
}
}
}
return _cartItems;
}
catch ( Exception e )
{
e.printStackTrace( );
throw e;
}
finally
{
if ( s != null )
{
s.close( );
}
}