public Movie insert(Movie movie) {
		if (movie == null)
			return null;

		try {

			Connection connection = DataSourceUtils.getConnection(dataSource);

			PreparedStatement statement = connection.prepareStatement(
					"INSERT INTO movie (name, year,description,director) "
							+ "VALUES (?, ?, ?, ?)",
					Statement.RETURN_GENERATED_KEYS);

			statement.setString(1, movie.getName());
			statement.setInt(2, movie.getYear());
			statement.setString(3, movie.getDescripcion());
			statement.setString(4, movie.getDirector());

			statement.executeUpdate();

			ResultSet resultSet = statement.getGeneratedKeys();

			if (resultSet != null && resultSet.next())
				movie.setId(resultSet.getInt(1));
			// connection.close();
		} catch (SQLException e) {
			throw new RuntimeException(e);
		}

		return movie;
	}