openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Beer <david.m.b...@googlemail.com>
Subject Multiple Identity for a class
Date Sun, 13 Feb 2011 18:27:38 GMT
Hi All

I have a class that extends a entity with a standard ID in. In the
extended class I want to add another id field say userID. What would be
the best way of doing this.

My classes are structured as follows:

@Entity
public class Person implements Serializable {
    
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long id;

    //other fields and methods omitted

}

@Entity
public class Userbase extends Person {
    
    private Long userID; //other identity field

    // other values omitted
}

What would be the best way of achieving this. Would an Identity class be
sensible. If so are the any examples that use this method.

Thanks

David


Mime
View raw message