I have an entity Ticket.class
that has the following properties (amongst others):
@OneToMany(cascade = {CascadeType.PERSIST, CascadeType.MERGE, CascadeType.REMOVE})
private List<Comment> comments;
@Transient
private Comment comment;
I then have a method as follows:
public void edit() {
...
// Add the comment
comments.add(comment);
comment = new Comment();
// Persist the ticket
em.merge(ticket);
}
The problem I am facing is that when I next retrieve the Ticket
from the DB the @Transient
value is present and set to the last comment. This must be coming from a cache but I can't figure out where or how to flush it other than by restarting the server.