Hi, I would like to know if there is anyway I can do something similar to the following thing with JPA:
@ManyToMany(cascade=CascadeType.PERSIST)
List<String> trackKeywords;
Or do I need to create another model with a String attribute?
Hi, I would like to know if there is anyway I can do something similar to the following thing with JPA:
@ManyToMany(cascade=CascadeType.PERSIST)
List<String> trackKeywords;
Or do I need to create another model with a String attribute?
JPA does not support such a "collection of values". Hibernate does, though, so if you're using Hibernate, you can use the extensions (section 2.4.6.2.5) alongside the standard JPA annotations.
@CollectionOfElements
public List<String> getNickNames() {
return nickNames;
}
Otherwise, yes, you'll likely need to write a wrapper entity.
JPA2 supports collection of non-Entity types. Obviously that is not a M-N relation. As per 1-N non-persistable