java的Query库_java-@Query,存储库中的错误

也许由于我的实体具有关系而在@Query中出错?

哪个存储库包含错误.

Error creating bean with name ‘clickRepository’: Invocation of init

method failed; nested exception is java.lang.IllegalArgumentException:

Validation failed for query for method public abstract

java.lang.String

com.qoobico.remindme.server.repository.ClickRepository.sent(java.lang.String,long)!

调节器

@Autowired

private ClickService service;

/*

i.e. information about fullname_client, id_banner sent to server from client

*/

@RequestMapping(value = "/sentemail", method = RequestMethod.POST)

@ResponseBody

public String sentClick(@RequestParam ("fullnameClient") String fullnameClient,@RequestParam ("idbanners") long idbanners) {

return service.sent(fullnameClient, idbanners);

}

知识库

@Query("SELECT c.fullnameClient FROM Click AS c join c.idBanner Banners b WHERE b.idBanner = :idbanners AND c.fullnameClient = :fullnameClient")

String sent(@Param("fullnameClient") String fullnameClient, @Param("idbanners") long idbanners);

实体点击

@Id

@Column(name = "id_click", unique = true, nullable = false)

@GeneratedValue(generator = "increment")

@GenericGenerator(name = "increment", strategy = "increment")

private long idClick;

@ManyToOne(fetch = FetchType.EAGER, cascade = {CascadeType.MERGE, CascadeType.PERSIST})

@JoinColumn(name = "id_banners", nullable = false)

private Banners idbanners;

@Column(name = "fullname_client", nullable = false, length = 50)

private String fullnameClient;

实体横幅

@Id

@Column(name = "id_banner", unique = true, nullable = false)

@GeneratedValue(generator = "increment")

@GenericGenerator(name = "increment", strategy = "increment")

private long idBanner;

@OneToMany(fetch = FetchType.EAGER, mappedBy = "banners")

private Set businessbanners;

@OneToMany(fetch = FetchType.EAGER, mappedBy = "idbanners")

private Set clicks;

错误

org.springframework.beans.factory.BeanCreationException: Error

creating bean with name ‘clickController’: Injection of autowired

dependencies failed; nested exception is

org.springframework.beans.factory.BeanCreationException: Could not

autowire field: private

com.qoobico.remindme.server.service.ClickService

com.qoobico.remindme.server.controller.ClickController.service; nested

exception is org.springframework.beans.factory.BeanCreationException:

Error creating bean with name ‘clickServiceImpl’: Injection of

autowired dependencies failed; nested exception is

org.springframework.beans.factory.BeanCreationException: Could not

autowire field: private

com.qoobico.remindme.server.repository.ClickRepository

com.qoobico.remindme.server.service.ClickServiceImpl.clickRepository;

nested exception is

org.springframework.beans.factory.BeanCreationException: Error

creating bean with name ‘clickRepository’: Invocation of init method

failed; nested exception is java.lang.IllegalArgumentException:

Validation failed for query for method public abstract

java.lang.String

com.qoobico.remindme.server.repository.ClickRepository.sent(java.lang.String,long)!

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值