Hello,

If I'm persisting a non-collection-valued generic field, I'd use the @Type
annotation and put (Entity.class) as its value (or the class name of the
field's required superclass if that's appropriate).

However, I have a situation where I'm mapping to a Set of entities that have
been generified themselves.  For instance, the following code snippet:

@Entity
public class PartyRelationship<P extends Party> {

    // ...

    @ManyToMany(cascade = {
            CascadeType.PERSIST,
            CascadeType.MERGE})
    private Set<PartyRole<P>> participants =
            new HashSet<PartyRole<P>>();

   // ...
}

What do I use as the class type in @Type?  Can this even be done?

Thanks in advance if anyone knows this.

Cheers,
--
Alexander R. Saint Croix

Reply via email to