You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@openjpa.apache.org by Alexander Saint Croix <sa...@gmail.com> on 2008/01/14 07:38:56 UTC

Collection valued generic references and @Type annotation

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

Re: Collection valued generic references and @Type annotation

Posted by Alexander Saint Croix <sa...@gmail.com>.
Pinaki,

This worked perfectly!  Thank you once again.  I just added the openjpa
1.0.1 dependency to my M2 build and turned off JPA checking in IDEA.  I did
some digging and it seems like there IS an IDEA plugin for OpenJPA in JIRA,
so will follow up on that if I can get it working.

Cheers,
--
Alexander R. Saint Croix

Re: Collection valued generic references and @Type annotation

Posted by Pinaki Poddar <pp...@apache.org>.
Look for @ElementType in Section 3.2.6 of OpenJPA manual
 
http://openjpa.apache.org/docs/latest/manual/manual.html

-- 
View this message in context: http://www.nabble.com/Collection-valued-generic-references-and-%40Type-annotation-tp14796101p14803690.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.