我有使用弹簧靴。我曾经加入三个实体来获取存储库中的数据。但它显示以下错误..
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'menuRightRepo': Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Validation failed for query for method public abstract java.util.List...
Caused by: java.lang.IllegalArgumentException: Validation failed for query for method public abstract java.util.List
我用过下面的代码..
我的第一个名为MenuNameEntity的实体如下
@Entity @Table(name = "MenuName") public class MenuNameEntity { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "id") private long id; private String parentId; private String menuName; private String status; // getter and setter }
我的第二个实体在下面
@Entity @Table(name = "MenuChild") public class MenuChildEntity { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "id") private long id; private String parentId; private String childMenuName; private String url; private String status; //getter and setter }
我的第三个实体在下面
@Entity @Table(name = "MenuRight") public class MenuRightEntity { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "id") private long id; private String companyId; private String userId; private String url; private String status; private String enqMode; private String insertMode; private String updateMode; private String deleteMode; //getter and setter }
我的 MenuRightRepository 如下
public interface MenuRightRepo extends JpaRepository<MenuRightEntity, Long> { @Query("select new com.rms.info.MenuRightResponse(m.companyId, m.userId,m.enqMode,m.insertMode,m.updateMode,m.deleteMode, p.parentId,c.childId,c.childMenuName,c.url) from MenuNameEntity p,MenuChildEntity c,MenuRightEntity m where p.parentId = c.parentId and p.status =1 and c.status =1 and c.url= m.url ") List<MenuRightResponse> getMenuMenuRights(); }
我已经使用MenuRightResponse来绑定从存储库中获取的值
package com.rms.info; public class MenuRightResponse { private String companyId= ""; private String userId= ""; private String enqMode= ""; private String insertMode= ""; private String updateMode= ""; private String deleteMode= ""; private String parentId= ""; private String childId= ""; private String childMenuName= ""; private String url= ""; public MenuRightResponse(String companyId, String userId, String enqMode, String insertMode, String updateMode, String deleteMode, String parentId, String childId, String childMenuName, String url) { super(); this.companyId = companyId; this.userId = userId; this.enqMode = enqMode; this.insertMode = insertMode; this.updateMode = updateMode; this.deleteMode = deleteMode; this.parentId = parentId; this.childId = childId; this.childMenuName = childMenuName; this.url = url; } //getter and setter }
当我在 MenuRightRepo 中调用 getMenuMenuRights() 时,它显示了上述错误。我没有使用任何主键和外键。代码有什么问题。请帮我