我搜索了这个但无法更正我的查询。需要帮助。这是我的VU360User
use Zend\Session\Container;
public function indexAction()
{
$session = new Container('sessionsample');
$session->offsetSet('id',1);
}
这是我的LmsRole类
@Entity
public class VU360User extends AuditedEntity implements UserDetails, CredentialsContainer, Cloneable {
...
private Learner learner;
private Set<LmsRole> lmsRoles;
...
@OneToOne(mappedBy = "vu360User", fetch=FetchType.LAZY)
public Learner getLearner() {
return learner;
}
//Setter
@ManyToMany(fetch=FetchType.LAZY)
@JoinTable(
name = "VU360USER_ROLE",
joinColumns = {
@JoinColumn(name = "USER_ID", referencedColumnName = "ID")
},
inverseJoinColumns = {
@JoinColumn(name = "ROLE_ID", referencedColumnName = "ID")
}
)
public Set<LmsRole> getLmsRoles() {
return lmsRoles;
}
//Setter
}
这是我的LmsRoleLmsFeature类
@Entity
public class LmsRole extends BaseEntity implements GrantedAuthority {
....
private List<LmsRoleLmsFeature> lmsRoleLmsFeature;
@OneToMany(mappedBy = "lmsRole", fetch=FetchType.LAZY)
public List<LmsRoleLmsFeature> getLmsRoleLmsFeature() {
return lmsRoleLmsFeature;
}
public void setLmsRoleLmsFeature(List<LmsRoleLmsFeature> lmsRoleLmsFeature) {
this.lmsRoleLmsFeature = lmsRoleLmsFeature;
}
...
}
现在这里是我想要进行的查询但是获得异常
@Entity
public class LmsRoleLmsFeature extends BaseEntity implements Serializable{
...
private LmsRole lmsRole;
private LmsFeature lmsFeature;
@ManyToOne(fetch=FetchType.LAZY)
@JoinColumn(name="LMSROLE_ID")
public LmsRole getLmsRole() {
return lmsRole;
}
@ManyToOne(fetch=FetchType.LAZY)
@JoinColumn(name="LMSFEATURE_ID")
public LmsFeature getLmsFeature() {
return lmsFeature;
}
...
}
我遇到了异常
@Query("select distinct u, l, c, d, ta, la, p, ra, i from #{#entityName} u, IN (u.lmsRoles) lr "
+ "join fetch u.learner l "
+ "join fetch l.customer c "
+ "join fetch c.distributor d "
+ "join fetch u.trainingAdministrator ta "
+ "join fetch u.lmsAdministrator la "
+ "join fetch u.proctor p "
+ "join fetch u.regulatoryAnalyst ra "
+ "join fetch u.instructor i "
+ "join u.lmsRoles.lmsRoleLmsFeature lrlf "
//+ "join lr.lmsRoleLmsFeature lrlf "
+ "where u.username = :userName and c.activeTf = true and d.status = true")
VU360User findByUserNameWithAllEntitiesAssociations(@Param("userName")String userName);
我试过加入,但我无法做到。我尝试了不同的设置但无法解决它。请帮忙。
由于