(no commit message)
[cdmlib.git] / cdmlibrary / src / main / java / eu / etaxonomy / cdm / model / common / RelationshipTermBase.java
index 8d23aab13b9ebc2520367b6410fd2d734aec425b..c2174abcec2d0b864a60cfd4799a40067a88009d 100644 (file)
@@ -6,8 +6,10 @@ import java.util.Set;
 import javax.persistence.Entity;
 import javax.persistence.Inheritance;
 import javax.persistence.InheritanceType;
+import javax.persistence.JoinTable;
 import javax.persistence.MappedSuperclass;
 import javax.persistence.OneToMany;
+import javax.persistence.Table;
 import javax.persistence.Transient;
 
 import org.apache.log4j.Logger;
@@ -48,6 +50,7 @@ public abstract class RelationshipTermBase extends OrderedTermBase {
        
        
        @OneToMany
+       @JoinTable(name="RelationshipTermBase_inverseRepresentation")
        @Cascade({CascadeType.SAVE_UPDATE, CascadeType.DELETE})
        public Set<Representation> getInverseRepresentations() {
                return inverseRepresentations;
@@ -56,11 +59,15 @@ public abstract class RelationshipTermBase extends OrderedTermBase {
                        Set<Representation> inverseRepresentations) {
                this.inverseRepresentations = inverseRepresentations;
        }
-       public void addRepresentation(Representation representation) {
-               this.inverseRepresentations.add(representation);
+       public void addInverseRepresentation(Representation inverseRepresentation) {
+               this.inverseRepresentations.add(inverseRepresentation);
        }
-       public void removeRepresentation(Representation representation) {
-               this.inverseRepresentations.remove(representation);
+       public void removeInverseRepresentation(Representation inverseRepresentation) {
+               this.inverseRepresentations.remove(inverseRepresentation);
+       }
+       public void addRepresentation(Representation representation, Representation inverseRepresentation) {
+               this.addRepresentation(representation);
+               this.addInverseRepresentation(inverseRepresentation);
        }
        
        @Transient