Hi,
I would like to retrieve many 'Access' which have one 'Role' in common.
It's the Named Querie
SELECT access FROM Access AS access WHERE :role MEMBER OF access.listRole
The Access Entity
public class Access implements Serializable {
@Id
@GeneratedValue(strategy=GenerationType.AUTO)
private Long id;
private String name;
private String libelle;
@ManyToOne
private Module oneModule;
@ManyToMany
private List<Role> listRole;
/* Setter & Getter */
}
The Role Entity
public class Role implements Serializable {
@Id
@GeneratedValue(strategy=GenerationType.AUTO)
private Long id;
private String name;
private String description;
@Enumerated(EnumType.STRING)
private Flag oneFlag;
@Transient
private int lengthAccess;
@OneToMany(mappedBy="oneRole")
private List<UserAccount> listUserAccount;
@ManyToMany
private List<Access> listAccess;
/* Geter & Setter */
}
But I don't achieve to do the right EJB-QL !
Configuration:
- EJB 3
- MySQL (InnoDB)
- jBoss
- Plop
Thanks.