@POST
	@Consumes(MediaType.LIBROS_API_RESENA)
	@Produces(MediaType.LIBROS_API_RESENA)
	public Resena createResena(@PathParam("idlibro") String idlibro,
			Resena resena) {
		String username = security.getUserPrincipal().getName();
		Connection conn = null;
		Statement stmt = null;
		try {
			conn = ds.getConnection();
		} catch (SQLException e) {
			throw new ServiceUnavailableException(e.getMessage());
		}
		try {
			stmt = conn.createStatement();
			String update = null; // TODO: create update query
			update = "INSERT INTO resenas (idlibro,username,texto) VALUES ('"
					+ idlibro + "','" + username + "' ,'" + resena.getTexto()
					+ "')";
			stmt.executeUpdate(update, Statement.RETURN_GENERATED_KEYS);
			ResultSet rs = stmt.getGeneratedKeys();
			if (rs.next()) {
				int idres = rs.getInt(1);
				rs.close();
				String 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();
			}
		}
		return resena;
	}