hi i have a class named Activity it has a many to many self relation my annotation is as fallow:
@Entity @Table(name = "Activity") @Inheritance(strategy = InheritanceType.SINGLE_TABLE) @DiscriminatorColumn(name = "type", discriminatorType = DiscriminatorType.STRING) @javax.persistence.SequenceGenerator( name = "SEQ_Activity", sequenceName = "SEQ_Activity", allocationSize = 1)
public class Activity implements Serializable { @Id @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_Activity") @Column(name = "id") private Long id; @ManyToMany(targetEntity = Activity.class) @JoinTable(name = "prerequisiteactivity", joinColumns = {@JoinColumn(name = "act")}, inverseJoinColumns = {@JoinColumn(name = "pre")}) private Set<Activity> prerequisiteActivity = new HashSet<Activity>();
@ManyToMany(targetEntity = Activity.class, mappedBy = "prerequisiteActivity") private Set<Activity> postRequisiteActivity = new HashSet<Activity>(); }
when i try to query my Activity class by ristriction on prerequisiteActivity & postRequisiteActivity i get the "ORA-00918: column ambiguously defined" exception the select statemnt generated by hibernate is like this
select * from (select ... prerequisi60_.act as act, activity33_.id as pre, ... postrequis49_.pre as pre, activity36_.id as act, ... from from Activity this_ ... inner join prerequisiteactivity prerequisi60_ on this_.id=prerequisi60_.act inner join Activity activity33_ on prerequisi60_.pre=activity33_.id inner join prerequisiteactivity postrequis49_ on this_.id=postrequis49_.pre inner join Activity activity36_ on postrequis49_.act=activity36_.id where ... ) where rownum <= ?
|