0
I’m using jpa and I have these two entities:
@Entity
@JsonIdentityInfo(
generator = ObjectIdGenerators.PropertyGenerator.class,
property = "id")
public class Categoria implements Serializable {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@NotNull
private int id;
private String tipo;
@JsonBackReference
@OneToMany(mappedBy = "categoria_id")
private List<Post> categoria_post;
}
@Entity
@JsonIdentityInfo(
generator = ObjectIdGenerators.PropertyGenerator.class,
property = "id")
public class Post implements Serializable {
@Id
@GeneratedValue(strategy =GenerationType.IDENTITY)
private int id;
@NotNull
private String titulo;
@NotNull
@JsonManagedReference
@ManyToOne
private Categoria categoria_id;
@NotNull
private String descricao;
private String img;
@ManyToOne
private Usuario post_usuario;
private int likes;
}
When I post to persist an object in the database, I get this exception:
javax.servlet.Servletexception: javax.ws.rs.Processingexception: Error deserializing Object from Entity stream. root cause
javax.ws.rs.Processingexception: Error deserializing Object from Entity stream. root cause
javax.json.bind.Jsonbexception: Error deserialize JSON value into type: class com.emerich.model.Category.
Can you put the error text? It looks better to read, maybe even to copy the text for a reply
– Jefferson Quesado
@Jeffersonquesado javax.ws.rs.Processingexception: Error deserializing Object from Entity stream. javax.json.bind.Jsonbexception: Error deserialize JSON value into type: class com.emerich.model.Category.
– gemerich