为什么在@query中使用join时出现错误?

时间:2018-12-24 20:24:13

标签: spring join autowired

我正在尝试创建一个包含内部联接的查询,但是我遇到了错误

public class Bordereau implements Serializable {
@Id
@GeneratedValue
private Long idBourdereau;
@Temporal(TemporalType.TIMESTAMP)
private Date date_ajout;
@Temporal(TemporalType.TIMESTAMP)
private Date date_pick_up;
private String gouvernerat_dest;
private String delegation_dest;
private String address_dest;
private String concernant_dest;
private int codepostal_dest;
private String numtel_dest;
private String numtel_dest2;
@OneToOne
@JoinColumn(name="idutilisateur")
private Utilisateur fournisseur;
private String gouvernerat_client;
private String address_client;
private int codepostal_client;
private String numtel_client;

private Long num_commande;
private Long prix_commande;
private int nombre_colis;
private String libelle_commande;
private String format_colis;
@Temporal(TemporalType.TIMESTAMP)
private Date liverer_avant;

private String pick_up;}



public class Bordereau implements Serializable {
@Id
@GeneratedValue
private Long idBourdereau;
@Temporal(TemporalType.TIMESTAMP)
private Date date_ajout;
@Temporal(TemporalType.TIMESTAMP)
private Date date_pick_up;
private String gouvernerat_dest;
private String delegation_dest;
private String address_dest;
private String concernant_dest;
private int codepostal_dest;
private String numtel_dest;
private String numtel_dest2;
@OneToOne
@JoinColumn(name="idutilisateur")
private Utilisateur fournisseur;
private String gouvernerat_client;
private String address_client;
private int codepostal_client;
private String numtel_client;

private Long num_commande;
private Long prix_commande;
private int nombre_colis;
private String libelle_commande;
private String format_colis;
@Temporal(TemporalType.TIMESTAMP)
private Date liverer_avant;

private String pick_up;

}

@Query("Select c from Bordereau c " + "join c.fournisseur user where user.idutilisateur = :idutilisateur" ) public List<Bordereau> getTodayParID(@Param("idutilisateur")long idutilisateur);

@RequestMapping(value = "/bordereaux/today/id={id}", method = RequestMethod.GET)
private List<Bordereau> getToday(@PathVariable Long id) {
    Date today = new Date();
    Utilisateur user = utilisateur.getOne(id);
    if(user != null) {
        switch  (user.getRole().getDescription()){
            case "Fournisseur":return bourdereau.getTodayParID(/*today, today,*/user.getIdutilisateur());
            //case "User":return bourdereau.getTodayParMagasin(today, today,user.getMagasin().getIdMagasin());
            case "Admin":return bourdereau.getTodayAll(today, today);
        }

    }
    return new ArrayList<>();
}

因此,当我调用方法getToday时,我得到了错误enter image description here的错误提示

有人可以帮助我吗?我想在特定日期获得特定用户的所有权限。 我已经尝试了很多方法,但是没有任何效果,即使使用本地查询,我也得到了相同的结果

0 个答案:

没有答案