Package org.geekhub.objects

Examples of org.geekhub.objects.Movie


                "movies_actors.movie_id = ?";

        List<Movie> movieList = jdbcTemplate.query(sql, new RowMapper<Movie>() {
            @Override
            public Movie mapRow(ResultSet resultSet, int i) throws SQLException {
                return new Movie(resultSet.getInt(1), resultSet.getString(2), resultSet.getString(3));
            }
        });

        for (final Movie movie : movieList) {
            List<Actor> actorList = jdbcTemplate.query(moviesSql, new PreparedStatementSetter() {
View Full Code Here


                            preparedStatement.setString(1, String.valueOf(actor.getId()));
                        }
                    }, new RowMapper<Movie>() {
                        @Override
                        public Movie mapRow(ResultSet resultSet, int i) throws SQLException {
                            return new Movie(resultSet.getInt(1), resultSet.getString(2), resultSet.getString(3));
                        }
                    }
            );
            actor.setMovieList(movieList);
        }
View Full Code Here

        Actor actor = jdbcTemplate.queryForObject(sql, new Object[]{id}, new BeanPropertyRowMapper<Actor>(Actor.class));
        List<Movie> movieList = jdbcTemplate.query(moviesSql, new Object[]{actor.getId()}, new RowMapper<Movie>() {
            @Override
            public Movie mapRow(ResultSet resultSet, int i) throws SQLException {
                return new Movie(resultSet.getInt(1), resultSet.getString(2), resultSet.getString(3));
            }
        });
        actor.setMovieList(movieList);
        return actor;
    }
View Full Code Here

        jdbcTemplate.update(sql, actor.getFirstName(), actor.getLastName(), actor.getBirthDate(), actor.getId());
        jdbcTemplate.update(deleteMoviesSql, actor.getId());
        jdbcTemplate.batchUpdate(createMoviesSql, new BatchPreparedStatementSetter() {
            @Override
            public void setValues(PreparedStatement ps, int i) throws SQLException {
                Movie movie = actor.getMovieList().get(i);
                ps.setInt(1, movie.getId());
                ps.setInt(2, actor.getId());
            }

            @Override
            public int getBatchSize() {
View Full Code Here

    @InitBinder
    public void initBinder(WebDataBinder binder) {
        binder.registerCustomEditor(Movie.class, new PropertyEditorSupport() {
            @Override
            public void setAsText(String text) throws IllegalArgumentException {
                Movie movie = new Movie();
                movie.setId(Integer.parseInt(text));
                setValue(movie);
            }
        });
    }
View Full Code Here

        return "actor_form";
    }

    @RequestMapping(value = "/create-movie.html", method = RequestMethod.GET)
    public String editMovie(ModelMap model) {
        model.addAttribute("movie", new Movie());
        model.addAttribute("save_or_update", "Save");
        return "movie_form";
    }
View Full Code Here

        return "movie_form";
    }

    @RequestMapping("/edit-movie")
    public String editMovie(@RequestParam int id, ModelMap model) {
        Movie movie = movieDAO.getById(id);
        model.addAttribute("movie", movie);
        model.addAttribute("save_or_update", "Update");
        return "movie_form";
    }
View Full Code Here

        ValidationUtils.rejectIfEmptyOrWhitespace(errors, "name", "required.name",
                "Film Name is required!");
        ValidationUtils.rejectIfEmptyOrWhitespace(errors, "year", "required.year",
                "Year is required!");

        Movie movie = (Movie) o;
        try {
            int year = Integer.parseInt(movie.getYear());
            if (year <= 0) {
                errors.rejectValue("year", "movie.year", "Year must be a positive number!");
            }
        } catch (NumberFormatException e) {
            errors.rejectValue("year", "movie.year", "Year must be a positive number!");
View Full Code Here

TOP

Related Classes of org.geekhub.objects.Movie

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.