0 Replies Latest reply on Jul 2, 2007 7:02 AM by serj f

    can have 2 joins on same column?

    serj f Newbie


      is it possible to have 2 columns in a table (Usr) who keep references to different records from another table (Member). I want to move a member from a list to another, without removing and creating a new Member. For example this code:

      //Usr u
      Tournamentmember t = new Tournamentmember();
      //Tournamentmember t
      u.getMembers().remove(t);//delete from one list
      u.getArchivedMembers().add(t);//add to new list

      make's me to have removed member (t) in members collection too, even if I removed before (it is in both list!!!). Thanks for help

      This are my table:
      class Usr{
       private java.util.Collection<Member> members;
       private java.util.Collection<Member> archivedMembers;
       @OneToMany(mappedBy = "usr", fetch = FetchType.LAZY)
       public java.util.Collection<Member> getMembers() {
       return members;
       public void setMembers(java.util.Collection<Member> members) {
       this.members= members;
       @OneToMany(mappedBy = "usr", fetch = FetchType.LAZY)
       public java.util.Collection<Member> getArchivedMembers() {
       return archivedMembers;
       public void setArchivedMembers(java.util.Collection<Member> archivedMembers) {
       this.archivedMembers= archivedMembers;
      class Member{
       @ManyToOne(fetch = FetchType.EAGER)
       //@JoinColumn(table="Usr", referencedColumnName = "id")
       public com.joyplay.ejb.persistence.Usr getUsr() {
       return usr;
       public void setUsr(com.joyplay.ejb.persistence.Usr usr) {
       this.usr = usr;