コード例 #1
0
ファイル: PositionDao.java プロジェクト: IanPFoertsch/Market
 private PositionCollection packagePositionsToCollection(List<Position> positions) {
   PositionCollection positionCollection = new PositionCollection();
   // create a new arraylist of positions and loat the List<position> into it
   ArrayList<Position> positionsArray = new ArrayList<Position>(positions);
   // set the appropriate field of the collection
   positionCollection.setPositions(positionsArray);
   // return the collection.
   return positionCollection;
 }
コード例 #2
0
ファイル: PositionDao.java プロジェクト: IanPFoertsch/Market
 public PositionCollection getAllPositions() {
   // define the select all query string
   String queryString = "SELECT p FROM Position p";
   // execute the query on the database
   //
   TypedQuery<Position> query = this.entityManager.createQuery(queryString, Position.class);
   List<Position> positions = query.getResultList();
   // initialize a positions collection object
   PositionCollection positionCollection = new PositionCollection();
   // create a new arraylist of positions and loat the List<position> into it
   ArrayList<Position> positionsArray = new ArrayList<Position>(positions);
   // set the appropriate field of the collection
   positionCollection.setPositions(positionsArray);
   // return the collection.
   return positionCollection;
 }