[jboss-cvs] jboss-seam/examples/seambay/src/org/jboss/seam/example/seambay ...

Shane Bryzak sbryzak at redhat.com
Thu Aug 23 00:25:18 EDT 2007


  User: sbryzak2
  Date: 07/08/23 00:25:18

  Added:       examples/seambay/src/org/jboss/seam/example/seambay  
                        AuctionEndAction.java BidHistory.java
  Log:
  missing classes
  
  Revision  Changes    Path
  1.1      date: 2007/08/23 04:25:18;  author: sbryzak2;  state: Exp;jboss-seam/examples/seambay/src/org/jboss/seam/example/seambay/AuctionEndAction.java
  
  Index: AuctionEndAction.java
  ===================================================================
  package org.jboss.seam.example.seambay;
  
  import java.util.Date;
  
  import javax.persistence.EntityManager;
  import javax.persistence.LockModeType;
  
  import org.jboss.seam.annotations.In;
  import org.jboss.seam.annotations.Name;
  import org.jboss.seam.annotations.Transactional;
  import org.jboss.seam.annotations.async.Asynchronous;
  import org.jboss.seam.annotations.async.Expiration;
  
  @Name("auctionEnd")
  public class AuctionEndAction
  {
     @In EntityManager entityManager;
     
     @Asynchronous
     @Transactional
     public void endAuction(int auctionId, @Expiration Date endDate)
     {
        System.out.println("Auction " + auctionId + " ending");
        
        Auction auction = entityManager.find(Auction.class, auctionId);
        
        entityManager.lock(auction, LockModeType.WRITE);
        
        auction.setStatus(Auction.STATUS_COMPLETED);
        
        entityManager.merge(auction);
     }
  }
  
  
  
  1.1      date: 2007/08/23 04:25:18;  author: sbryzak2;  state: Exp;jboss-seam/examples/seambay/src/org/jboss/seam/example/seambay/BidHistory.java
  
  Index: BidHistory.java
  ===================================================================
  package org.jboss.seam.example.seambay;
  
  import java.util.List;
  
  import javax.persistence.EntityManager;
  
  import org.jboss.seam.annotations.Factory;
  import org.jboss.seam.annotations.In;
  import org.jboss.seam.annotations.Name;
  
  @Name("bidHistory")
  public class BidHistory
  {
     @In
     private EntityManager entityManager;
     
     @SuppressWarnings("unchecked")
     @Factory("history")
     public List<Bid> getHistory()
     {
        return entityManager.createQuery("from Bid where auction = #{auction}")
            .getResultList();      
     }
  }
  
  
  



More information about the jboss-cvs-commits mailing list