Questions tagged «spring-data-jpa»

Spring Data-JPA是Spring Data伞项目的一部分,它使实现基于JPA的存储库变得容易

9
具有参数属性的Spring数据JPA查询
声明使用输入参数的属性作为查询参数的Spring数据JPA查询的最简单方法是什么? 例如,假设我有一个实体类: public class Person { @Id private long id; @Column private String forename; @Column private String surname; } 和另一类: public class Name { private String forename; private String surname; [constructor and getters] } ...那么我想编写一个Spring数据存储库,如下所示: public interface PersonRepository extends CrudRepository<Person, Long> { @Query("select p from Person p where p.forename = …


6
如何使用Spring Data JPA通过Sort和Pageable即时查询数据?
我在我的项目中尝试使用Spring数据JPA。我想知道是否有现成的API通过Sort和来查询数据Pageable。当然,我知道我可以自己编写该方法,我只想知道是否有一个现成的方法。我的DAO扩展JpaRepository,我发现可以调用以下方法: findAll(); findAll(Pageable pageable); findAll(Sort sort); 但是没有这样的方法findAll(Sort sort, Pageable pageable),所以我很好奇。

8
Spring数据jpa-未定义名为'entityManagerFactory'的bean。自动连接的依赖项注入失败
我正在使用spring数据jpa,hibernate,mysql,tomcat7,maven开发应用程序,并且创建错误。我试图弄清楚,但失败了。 错误是在设置构造函数参数时无法解析对bean'entityManagerFactory'的引用;没有定义名为'entityManagerFactory'的bean。自动连接的依赖项注入失败 org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'initDbService': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.wahid.cse.repository.RoleRepository org.wahid.cse.service.InitDbService.roleRepository; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'roleRepository': Cannot create inner bean '(inner bean)#c08f81' of type [org.springframework.orm.jpa.SharedEntityManagerCreator] while setting bean property 'entityManager'; nested …

12
删除无法使用JpaRepository
我有一个Spring 4应用程序,试图从数据库中删除实体的实例。我有以下实体: @Entity public class Token implements Serializable { @Id @SequenceGenerator(name = "seqToken", sequenceName = "SEQ_TOKEN", initialValue = 500, allocationSize = 1) @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "seqToken") @Column(name = "TOKEN_ID", nullable = false, precision = 19, scale = 0) private Long id; @NotNull @Column(name = "VALUE", unique = true) …

5
Springfox swagger在Spring Boot 2.2.0中不起作用
我想将Spring Boot v2.1.9升级到2.2.0。但是升级之后,我得到了一些例外,这表示Spring Fox使用的是Spring-plugin-core的旧版本。 是否有其他替代解决方案,还是我需要放弃springfox插件? *************************** APPLICATION FAILED TO START *************************** Description: An attempt was made to call a method that does not exist. The attempt was made from the following location: springfox.documentation.spring.web.plugins.DocumentationPluginsManager.createContextBuilder(DocumentationPluginsManager.java:152) The following method did not exist: org.springframework.plugin.core.PluginRegistry.getPluginFor(Ljava/lang/Object;Lorg/springframework/plugin/core/Plugin;)Lorg/springframework/plugin/core/Plugin; The method's class, org.springframework.plugin.core.PluginRegistry, is available from the following locations: …
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.