示例#1
0
  public void transationAddGame() {

    final List<Game> games = new ArrayList<Game>();
    final Game game1 = new Game();
    final Game game2 = new Game();

    game1.setId(31);
    game1.setName("New Game 31");
    game1.setPrice("10");

    game2.setId(32);
    game2.setName("New Game 32");
    game2.setPrice("20");

    games.add(game1);
    games.add(game2);
    // add game2 again, will cause error due to unique name, so roll back to save point
    games.add(game2);

    try {
      System.err.println("\nAdding new games...");
      gameDao.transationAddGame(games);
    } catch (final SQLException e) {
      e.printStackTrace();
    }
  }
示例#2
0
 public void addNewGame() {
   final Game game = new Game();
   // random id just for demo
   final int id = ThreadLocalRandom.current().nextInt(10, 30);
   game.setId(id);
   game.setName("New Game " + id);
   game.setPrice("" + id);
   game.setReview("There is no review.");
   gameDao.rowSetAddGame(game);
 }
示例#3
0
 public void deleteLastRow() {
   System.err.println("\nDeleting games...");
   gameDao.rowSetDeleteLastRow();
 }
示例#4
0
 public void printRowSetRetrievedGames() {
   gameDao.rowSetGetGame();
 }
示例#5
0
 public void getUpperCaseViaStoredProcedure(final String name) {
   System.err.println("\nCalling stored procedure...");
   gameDao.getUpperCaseViaStoredProcedure(name);
 }
示例#6
0
 public void getGamesViaPreparedStmt() {
   gameDao.getGames();
 }