put("last_name", actor.getLastName());
put("birth_date", actor.getBirthDate());
}
};
SimpleJdbcInsert jdbcInsert = new SimpleJdbcInsert(dataSource);
Number number = jdbcInsert.withTableName("actor").usingGeneratedKeyColumns("id").executeAndReturnKey(map);
actor.setId(number.intValue());
SimpleJdbcInsert insert = new SimpleJdbcInsert(dataSource).withTableName("movies_actors");
List<Movie> movieList = actor.getMovieList();
map = new HashMap<String, Object>();
for (Movie movie : movieList) {
map.put("actor_id", actor.getId());
map.put("movie_id", movie.getId());
insert.execute(map);
}
}