Bonjour
Effectivement, c'est tellement simple que j'ai honte. merci.
Par contre j'essaye de faire la même chose par défi avec
SELECT e.*, count(d) as countQuestions FROM EticThemesUser e join e.eticQuestionsUserCollection d group by e.*
Avec la classe Theme
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
|
@SqlResultSetMapping(
name = "findByIdThemeCountQuestions",
entities = {
@EntityResult(entityClass = EticThemesUser.class)
},
columns = {
@ColumnResult(name = "countQuestions")})
@Entity
@Table(name = "ETIC_THEMES_USER")
@XmlRootElement
public class EticThemesUser implements Serializable {
private static final long serialVersionUID = 1L;
// @Max(value=?) @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
@Id
@Basic(optional = false)
@NotNull
@Column(name = "ID_THEME")
private BigDecimal idTheme;
@Basic(optional = false)
@NotNull
@Size(min = 1, max = 250)
@Column(name = "LIBELLE_THEME")
private String libelleTheme;
@Basic(optional = false)
@NotNull
@Size(min = 1, max = 20)
@Column(name = "DEGRE")
private String degre;
@Basic(optional = false)
@NotNull
@Column(name = "ORDRE")
private BigInteger ordre;
@Basic(optional = false)
@NotNull
@Column(name = "ACTIF")
private short actif;
@Size(max = 500)
@Column(name = "TOOLTIP")
private String tooltip;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "idTheme")
private Collection<EticQuestionsUser> eticQuestionsUserCollection;
@Transient
private Integer countQuestions;
public EticThemesUser(BigDecimal idTheme) {
this.idTheme = idTheme;
}
public Integer getCountQuestions() {
return countQuestions;
} .... |
1 2 3 4
|
Internal Exception: java.sql.SQLSyntaxErrorException: ORA-00905: mot-clé absent
Error Code: 905
Call: SELECT e.*, count(d) as countQuestions FROM EticThemesUser e join e.eticQuestionsUserCollection d group by e.* |
j'utilise EclipseLink
Est ce que cela parle ?
Olivier
Partager