我有一个 Oracle 18.4.0 XE 数据库,我试图从 JPA 2.1 访问,由 Hibernate 5.2.17 实现。
我ManyToMany
在 2 个实体之间建立了联系:
public class PermissionEntity implements Serializable {
private static final long serialVersionUID = -3862680194592486778L;
@Id
@GeneratedValue
private Long id;
@Column(unique = true)
private String permission;
@ManyToMany
private List<RoleEntity> roles;
}
public class RoleEntity implements Serializable {
private static final long serialVersionUID = 8037069621015090165L;
@Column(unique = true)
private String name;
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE)
private Long id;
@ManyToMany(fetch = FetchType.LAZY, mappedBy = "roles")
private List<PermissionEntity> permissions;
}
尝试在 PermissionRepository: 上运行 Spring Data JPA 请求时findAllByPermission(Iterable<String> permissions)
,出现以下异常:
Error : 1797, Position : 140, Sql = select permission0_.id as id1_0_, permission0_.permission as permission2_0_ from PermissionEntity permission0_ where permission0_.permission=(:1 , :2 ), OriginalSql = select permission0_.id as id1_0_, permission0_.permission as permission2_0_ from PermissionEntity permission0_ where permission0_.permission=(? , ?), Error Msg = ORA-01797: this operator must be followed by ANY or ALL