我正在开发 EJB-JPA-JSF 项目。但我有一个问题。我收到此查询的错误:
select u from Ucretlendirme u join u.tarife_KullanimTipiServis tks join tks.kullanimTipiServis ks join ks.servis s join tks.tarife t join ks.kullanimTipi k where s.servisID=:sID and t.tarifeID=:tID and k.kullanimTipiID=:kID
Error: javax.ejb.EJBException: javax.persistence.PersistenceException: org.hibernate.HibernateException: More than one row with the given identifier was found: 1, for class: tr.com.vodafone.optimum.entities.Period
我该如何解决这个错误
@Entity
public class Period {
...
@ManyToOne
private PeriyodType periodType;
@OneToOne(mappedBy="period")
private Ucretlendirme ucretlendirme;
}
@Entity
public class PeriyodType {
....
@OneToMany(mappedBy="periodType",fetch=FetchType.LAZY)
private List<Period> periyodlar;
}
@Entity
public class Ucretlendirme {
...
@OneToOne
private Period period;
@OneToOne(mappedBy="ucretlendirme")
private Tarife_KullanimTipiServis tarife_KullanimTipiServis;
}
@Entity
public class Tarife_KullanimTipiServis {
....
@ManyToOne
private Tarife tarife;
@ManyToOne
private KullanimTipi_Servis kullanimTipiServis;
@OneToOne
private Ucretlendirme ucretlendirme;
}
@Entity
public class Tarife {
@OneToMany(mappedBy="tarife",fetch=FetchType.LAZY)
private List<Tarife_KullanimTipiServis> tarife_kullanimtipiservisler;
}
@Entity
public class KullanimTipi_Servis {
@ManyToOne
private KullanimTipi kullanimTipi;
@ManyToOne
private Servis servis;
@OneToMany(mappedBy="kullanimTipiServis",fetch=FetchType.LAZY)
private List<Tarife_KullanimTipiServis> tarife_kullanimtipiservisler;
}
@Entity
public class Servis {
@OneToMany(mappedBy="servis",fetch=FetchType.LAZY)
private List<KullanimTipi_Servis> kullanimtipi_servisler;
}
@Entity
public class KullanimTipi {
....
@OneToMany(mappedBy="kullanimTipi",fetch=FetchType.LAZY)
private List<KullanimTipi_Servis> kullanimtipi_servisler;
}