@PUT
	@Path("/{idres}")
	@Consumes(MediaType.LIBROS_API_RESENA)
	@Produces(MediaType.LIBROS_API_RESENA)
	public Resena updateResena(@PathParam("idres") String idres, Resena resena, @PathParam("idlibro") String idlibro) {

		String username;
		Connection conn = null;
		Statement stmt = null;
		String sql;
		ResultSet rs;

		try {
			conn = ds.getConnection();
		} catch (SQLException e) {
			throw new ServiceUnavailableException(e.getMessage());
		}

		try {
			stmt = conn.createStatement();
			sql = "SELECT * FROM resenas WHERE idres='" + idres + "'";
			rs = stmt.executeQuery(sql);
			rs.next();
			username = rs.getString("username");

		} catch (SQLException e) {
			throw new ResenaNotFoundException();
		}

		if (security.getUserPrincipal().getName().equals(username)) {
			try {
				stmt = conn.createStatement();
				String update = null;
				update = "UPDATE resenas SET resenas.texto ='"
						+ resena.getTexto() + "'WHERE idres='" + idres + "'";
				int rows = stmt.executeUpdate(update,
						Statement.RETURN_GENERATED_KEYS);
				if (rows != 0) {

					sql = "SELECT resenas.*, users.name FROM users INNER JOIN resenas ON(idres= '"
							+ idres + "' and users.username=resenas.username) ";
					rs = stmt.executeQuery(sql);
					if (rs.next()) {
						resena.setIdres(rs.getInt("idres"));
						resena.setIdlibro(rs.getInt("idlibro"));
						resena.setUsername(rs.getString("username"));
						resena.setName(rs.getString("name"));
						resena.setFecha(rs.getDate("fecha"));
						resena.setTexto(rs.getString("texto"));
						resena.add(LibrosAPILinkBuilder.buildURIResenaId(uriInfo, "self",rs.getInt("idres"),idlibro));						
					}
				} else
					throw new ResenaNotFoundException();
			} catch (SQLException e) {
				throw new InternalServerException(e.getMessage());
			} finally {
				try {
					stmt.close();
					conn.close();
				} catch (SQLException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}
			}
		} else {
		}
		return resena;
	}