我有以下JPA存储库:
@Repository
public interface EntityRepository extends JpaRepository<Long, Long> {
@Query(value = "SELECT e.id "
+ "FROM schema.entity e "
+ "WHERE e.number = :number", nativeQuery = true)
Long getEntityByNumber(@Param("number") String number);
}
我有以下例外:
引起:org.springframework.beans.factory.BeanCreationException:创建名为'jpaMappingContext'的bean时出错:init方法的调用失败;嵌套异常是java.lang.IllegalArgumentException:必须至少存在一个JPA元模型!
我做错了什么?
答案 0 :(得分:1)
您必须使用Long class创建@Entity。
像:
Private Sub MyMethod(sender As Object, e As RoutedEventArgs)
Dim mnuItm as MenuItem = DirectCast(sender, MenuItem)
Dim dataContext = DirectCast(mnuItm, MainWindow) '<-- change MainWindow to the name of the class where the MyList property is defined
Dim org = dataContext.Items
End Sub