I am using jpa 2.0 and I have the following object:
@Entity
public class Folder{
@ElementCollection
@CollectionTable(name="folder_files")
private Set<String> files;
}
Given the file name, I would like to delete all entries where the files == theGivenFileName. In sql, it will be something like this:
Delete from folder_files where files = XXX
Is there any way to fulfill this request using api criteria? If not, is there a way to execute this query using jpql?
UPDATE:
I think my question was not clear enough: Since jpql uses entities (not tables), I cannot just execute the sql written above, since I use @ElementCollection. I do not know how to handle this variable or even deal with it. I would like to delete all entries in this collection (in my case, files) that contain the given value from all entities. Is it possible to use jpql criteria or (even better) -api?