67,550
社区成员




String queryString = "select a.id,a.authority.id,a.name,a.description,b.id,b.name from Authority a left outer join Authority b where a.authority.id = b.id and a.authority.id is not null";
803 ERROR [org.hibernate.hql.PARSER] (http--127.0.0.1-8080-1) Path expected for join!
18:31:30,806 ERROR [org.hibernate.hql.PARSER] (http--127.0.0.1-8080-1) Invalid path: 'b.id'
18:31:30,808 ERROR [org.hibernate.hql.PARSER] (http--127.0.0.1-8080-1) Invalid path: 'b.id'
18:31:30,809 ERROR [org.hibernate.hql.PARSER] (http--127.0.0.1-8080-1) right-hand operand of a binary operator was null
18:31:30,809 ERROR [org.hibernate.hql.PARSER] (http--127.0.0.1-8080-1) <AST>:0:0: unexpected end of subtree
18:31:30,810 ERROR [dao.AuthorityDAO] (http--127.0.0.1-8080-1) find all failed: org.hibernate.hql.ast.QuerySyntaxException: Path expected for join! [select a.id,a.authority.id,a.name,a.description,b.id,b.name from pojo.Authority a left outer join Authority b where a.authority.id = b.id and a.authority.id is not null]
select a.id,a.parentRightID,a.name,b.id,b.name from [wgzxdms].[dbo].[authority] a left join [wgzxdms].[dbo].[authority] b
on a.parentRightID = b.id
select a,b from Authority a left join a.authority b
结贴,给分。
public class Authority implements java.io.Serializable {
// Fields
private Integer id;
private Authority authority;
private String name;
private String description;
private Set userAuthorities = new HashSet(0);
private Set authorities = new HashSet(0);
private Set roleAuthorities = new HashSet(0);
// Constructors
/** default constructor */
public Authority() {
}
/** minimal constructor */
public Authority(Integer id) {
this.id = id;
}
/** full constructor */
public Authority(Integer id, Authority authority, String name,
String description, Set userAuthorities, Set authorities,
Set roleAuthorities) {
this.id = id;
this.authority = authority;
this.name = name;
this.description = description;
this.userAuthorities = userAuthorities;
this.authorities = authorities;
this.roleAuthorities = roleAuthorities;
}
// Property accessors
public Integer getId() {
return this.id;
}
public void setId(Integer id) {
this.id = id;
}
public Authority getAuthority() {
return this.authority;
}
public void setAuthority(Authority authority) {
this.authority = authority;
}
public String getName() {
return this.name;
}
public void setName(String name) {
this.name = name;
}
public String getDescription() {
return this.description;
}
public void setDescription(String description) {
this.description = description;
}
public Set getUserAuthorities() {
return this.userAuthorities;
}
public void setUserAuthorities(Set userAuthorities) {
this.userAuthorities = userAuthorities;
}
public Set getAuthorities() {
return this.authorities;
}
public void setAuthorities(Set authorities) {
this.authorities = authorities;
}
public Set getRoleAuthorities() {
return this.roleAuthorities;
}
public void setRoleAuthorities(Set roleAuthorities) {
this.roleAuthorities = roleAuthorities;
}
}
<hibernate-mapping>
<class name="pojo.Authority" table="authority" schema="dbo" catalog="wgzxdms">
<id name="id" type="java.lang.Integer">
<column name="id" />
<generator class="identity" />
</id>
<many-to-one name="authority" class="pojo.Authority" fetch="join">
<column name="parentRightID" />
</many-to-one>
<property name="name" type="java.lang.String">
<column name="name" />
</property>
<property name="description" type="java.lang.String">
<column name="description" />
</property>
<set name="userAuthorities" inverse="true">
<key>
<column name="rightID" />
</key>
<one-to-many class="pojo.UserAuthority" />
</set>
<set name="authorities" inverse="true">
<key>
<column name="parentRightID" />
</key>
<one-to-many class="pojo.Authority" />
</set>
<set name="roleAuthorities" inverse="true">
<key>
<column name="rightID" />
</key>
<one-to-many class="pojo.RoleAuthority" />
</set>
</class>
</hibernate-mapping>
08:22:49,281 ERROR [org.hibernate.hql.PARSER] (http--127.0.0.1-8080-2) line 1:105: unexpected token: on
08:22:49,285 ERROR [dao.AuthorityDAO] (http--127.0.0.1-8080-2) find all failed: org.hibernate.hql.ast.QuerySyntaxException: unexpected token: on near line 1, column 105 [select a.id,a.authority.id,a.name,a.description,b.id,b.name from pojo.Authority a left join Authority b on a.authority.id = b.id where a.authority.id is not null]
org.hibernate.hql.ast.QuerySyntaxException: unexpected token: on near line 1, column 111 [select a.id,a.authority.id,a.name,a.description,b.id,b.name from pojo.Authority a left outer join Authority b on a.authority.id = b.id]
String queryString = "select a.id,a.authority.id,a.name,a.description,b.id,b.name from Authority a left outer join Authority b where a.authority.id = b.id";
仍然报错
18:38:03,382 ERROR [org.hibernate.hql.PARSER] (http--127.0.0.1-8080-1) Path expected for join!
18:38:03,385 ERROR [org.hibernate.hql.PARSER] (http--127.0.0.1-8080-1) Invalid path: 'b.id'
18:38:03,386 ERROR [org.hibernate.hql.PARSER] (http--127.0.0.1-8080-1) Invalid path: 'b.id'
18:38:03,387 ERROR [org.hibernate.hql.PARSER] (http--127.0.0.1-8080-1) right-hand operand of a binary operator was null
18:38:03,388 ERROR [dao.AuthorityDAO] (http--127.0.0.1-8080-1) find all failed: org.hibernate.hql.ast.QuerySyntaxException: Path expected for join! [select a.id,a.authority.id,a.name,a.description,b.id,b.name from pojo.Authority a left outer join Authority b where a.authority.id = b.id]