-
1 votesanswersviews
Apache Ignite唯一约束
我正在使用Apache Ignite和Spring Data . 我需要一个列“用户名”才能是唯一的 . 事实上,“用户名”是Ignite缓存的关键 . 我认为点燃还没有实现独特的约束 . 使用普通的点燃API,我不确定我是否可以像以下一样锁定: IgniteCache<String, Integer> cache = ignite.cache("userCache"... -
1 votesanswersviews
在Spring Data Cassandra中将实体类作为UDT
我有一个嵌套的POJO作为Cassandra实体,其中一个对象是表示一个表的Cassandra实体类 . 我正在尝试在Spring Data Cassandra中建模并得到以下错误: 只允许原始类型和原始类型的集合或映射 我的实体结构如下 //Definition of Single entity @Table Class A { @Primary Key Variable1 ... -
0 votesanswersviews
Spring数据jpa存储库检索多个计数
我有以下域实体:Conversation,它有一个Messages列表,每个都有一个 newFor 参与者集 . 对于谁,列表中的消息尚未被读取 . 我正在努力编写存储库接口方法(或查询)来检索具有该参与者的许多未读消息的会话映射 . Atm我使用以下内容只检索一个对话列表: @Query("SELECT c from Conversation c JOIN c.participants... -
0 votesanswersviews
使用spring boot mongo db读取嵌套文档
我需要搜索mongo db文档,只从文档中获取选择性属性 . 我的道: @Document(collection = "bug") public class BugDetails { @Id private String id; @Field("assignee.name") private String assignee; @Field... -
2 votesanswersviews
Spring JPA Auditing empty createdBy
我正在使用auditing capabilities of Spring Data并且有一个类似于此的类: @Entity @Audited @EntityListeners(AuditingEntityListener.class) @Table(name="Student") public class Student { @Id @GeneratedValu... -
0 votesanswersviews
是否可以将Spring Data Couchbase映射到外部文档(来自依赖)?
我需要从没有特定架构的传统Couchbase存储桶中检索数据 . 它可以从Couchbase Java客户端映射为 com.couchbase.client.java.document.StringDocument . 我可以使用Java客户端直接执行此操作: bucket.get(key, StringDocument.class) 但是如何使用 org.springframework.dat... -
799 votesanswersviews
如何解决Spring Data Maven Builds的“生命周期配置未涵盖的插件执行”
我正在尝试使用Spring Data and Neo4j . 我开始尝试跟随主站点链接的this guide . 特别是我把我的pom.xml从"Hello, World!" example file开始 . 这是我的pom.xml中针对导致问题的插件的剪辑... <plugin> <!-- Required to resolve aspectj-enhanc... -
29 votesanswersviews
Spring Boot,Spring Data JPA,带有多个DataSources
我正在尝试使用Spring Boot和Spring Data JPA将每个@Repositories连接到不同的DataSource . 我使用以下内容http://xantorohara.blogspot.com/2013/11/spring-boot-jdbc-with-multiple.html作为参考 . 以下是我试图使用Spring Data JPA实现类似解决方案时使用的代码 . Cu... -
1 votesanswersviews
Spring Data JPA - 刷新@PostPersist中的entityManager
我正在努力定义实体A和B之间的一对多双向关系,并意识到在持久化A以便B用B更新之后应该刷新entityManager . 这是解释here 在服务层,而不是重复调用 entityManager.refresh(entity) 在jpaRepository.saveAndFlush(实体)之后,我决定实现EntityListeners . 我在向EntityListener注入entityMana... -
3 votesanswersviews
Spring Data Rest 2.0.0.RELEASE以前使用RC1打破代码工作
我有一个项目,它正在使用Spring Data Rest . 我最初在我的pom.xml中有版本 2.0.0.BUILD-SNAPSHOT ,但在我上次更新时代码断开并在访问大多数 endpoints 时开始抛出以下 IllegalStateException : java.lang.IllegalStateException: No suitable resolver for argument ... -
0 votesanswersviews
Spring-boot 2.0.0启用auditJPA
我有一个审计JPA的示例项目 . 我正在尝试将此项目迁移到spring-boot 2.0.0.RELEASE,因此我得到一个aop类的卸载类异常,项目地址:https://github.com/richardcsantana/spring-audit-sample/tree/spring-boot-2.0.0 pom.xml: <?xml version="1.0" en... -
0 votesanswersviews
如何使用Spring过滤Mongodb文档中的数组
我有下面的文档结构 . { "_id" : { "teacherId" : "<teacherId>", "Year" : "<Year>" }, "groups" : [ { "groupId" : &... -
2 votesanswersviews
如何公开Spring Data Rest endpoints 的自定义实现
我有以下问题 . 我创建了一个使用spring-data的应用程序,并使用spring-data-rest将其公开为REST服务 . 一切顺利,直到我想要一个自定义实现 . 我用一个额外的方法创建了一个CustomSomethingRepository和SomethingRepositoryImpl . Spring数据存储库接口扩展了CustomSomethingRepository,一切都很... -
120 votesanswersviews
如何向Spring Data JPA添加自定义方法
我正在研究Spring Data JPA . 考虑下面的示例,我将默认使用所有crud和finder功能,如果我想自定义查找器,那么也可以在界面本身轻松完成 . @Transactional(readOnly = true) public interface AccountRepository extends JpaRepository<Account, Long> { @Que... -
3 votesanswersviews
与Spring Security User匹配的Spring Data JPA子查询对象
当我用 @Entity 获取 User 注释时,我试图提取"mutual friends"的计数,最好不必迭代所有分页结果并查询适当的值 . 这意味着对于任何给定的用户,结果可能会有所不同,具体取决于谁正在读取数据库 . 基本上是以下查询: select count(friendship) from Friendship friendship where fr... -
0 votesanswersviews
引起:org.hibernate.hql.internal.ast.QuerySyntaxException:projecttaskassignedtable
org.springframework.beans.factory.UnsatisfiedDependencyException:创建名为'projectManagementAPIsController'的bean时出错:通过字段'pCUMService'表示的不满意的依赖关系;嵌套异常是org.springframework.beans.factory.UnsatisfiedDependency... -
1 votesanswersviews
在spring boot中创建自定义查询时出错
我是 Spring 季启动新手,在向代码添加查询时遇到以下错误, org.springframework.beans.factory.UnsatisfiedDependencyException:创建名为'testController'的bean时出错:通过字段'testService'表示的不满意的依赖关系;嵌套异常是org.springframework.beans.factory.Bean... -
0 votesanswersviews
如何在Postgres Spring-data和liquibase中对齐列名?
我试图跟随this tutorial设置一个简单的 spring 启动应用程序与postgres . 他们使用Docker来设置db和liquibase . 我之前使用过spring-data和JPA,但没有使用postgres或liquibase . 我试图 Build 一个简单的学生数据库 . 这是我的实体: @Entity public class Student { @Id ... -
0 votesanswersviews
冲突的 Spring 季时间表
我有两个在不同时间运行的计划任务 . 第一项任务是每5秒运行一次,第二项任务是每10分钟运行一次 . @EnableScheduling public class ScheduledTask { @Autowired private taskService taskService; @Scheduled(every 5 second) public void s... -
0 votesanswersviews
不从事务中回滚数据
为什么即使抛出异常数据也没有从数据库回滚我设置了rollbackFor = Exception.class,当第二次访问被放入数据库时它仍然没有回滚数据 . @EnableTransactionManagement @Service public class VisitService { private final static ... -
0 votesanswersviews
在Spring 5.1中注册自定义存储库
有一种机制可以为此处描述的存储库提供自定义实现: https://docs.spring.io/spring-data/jpa/docs/current/reference/html/#repositories.custom-implementations 虽然在迁移到Spring Framework 5.1之后,由于覆盖了bean而停止了工作 . interface MyCustomReposi... -
4 votesanswersviews
查询@DBRef字段
使用:Spring 3.1.0.RELEASE,Spring Data MongoDB 1.0.0.RELEASE 我有一个像这样定义的文档类: @Document public class MyDoc { @Indexed @DBRef private User owner; ... 我正在尝试使用此存储库定义为特定用户选择所有MyDoc实例: public interface... -
7 votesanswersviews
Spring Data Mongodb - 用于收集不同类型的存储库
我有一个mongo集合,可能包含三种类型的实体,我映射到java类型: 节点 LeafType1 LeafType2 集合是使用父条目中的子节点的dbRefs来存储树状结构 . 我没有问这里:有没有办法使用 Repository 机制来处理可能包含不同类型对象的集合? 在一个集合中为不同类型声明几个存储库似乎不是一个好主意,因为当查询对象不是预期类型并且为抽象类创建一个所有可能类型... -
1 votesanswersviews
Forking使用Spring Data MongoDB编写
我有兴趣使用Spring Data MongoDB将相同的模型持久化到两个不同的集合,并使用Querydsl从两个集合中进行查询 . 根据我的研究,这似乎不可能有两个单独的存储库 . Spring Data MongoDB似乎没有提供覆盖给定存储库的集合名称的方法 . 相反,MongoTemplate类可以选择将集合名称指定为其大多数方法的最后一个参数,因此我尝试实现MongoTemplate支... -
0 votesanswersviews
使用$ in子句从MongoTemplate查询中删除引号
我有mongoTemplate查询与各种标准的组合 . 在这个查询中,我需要通过一组ID来选择文档 . 所以我使用“in”方法 . 这是我的代码: Query query = new Query(Criteria.where("sizeId").is(sizeId)); query.addCriteria(Criteria.where("companyId"... -
410 votesanswersviews
Spring Data JPA中的CrudRepository和JpaRepository接口有什么区别?
Spring Data JPA中 CrudRepository 和 JpaRepository 接口有什么区别? 当我在网上看到这些例子时,我看到它们在那里可以互换使用 . 它们之间有什么区别?你为什么要用一个而不是另一个? -
5 votesanswersviews
在Neo4J数据库中查找叶节点
我们有一个项目,我们使用Spring Data Neo4J . 其中一个重要实体如下所示: @NodeEntity public class Category { @GraphId Long id; String name; @RelatedTo(direction = Direction.INCOMING, type = "CHILD") ... -
0 votesanswersviews
如何看嵌入式mongo db创建的文档结构?
我正在使用带有嵌入式mongodb的Spring启动应用程序,应用程序运行正常,但我无法看到mongodb为实体生成的文档结构 . 谁能在这里帮忙! -
0 votesanswersviews
Spring Data Mongo返回列表而不是字符串
在我的Spring Boot应用程序中,我正在查询一组文档 . 我正在尝试执行聚合操作,将相似的字段组合在一起并计算它们 . 问题是,当返回正确的值时,它们应该只是正常的字符串“[\”测试名称\“]”应该是“测试名称” 我可以通过使用@Id注释来解决其中一个字段的问题,但Spring数据Mongo不喜欢复合键,因此我不能将其用作解决方案 . 如何只返回字符串值,而不是下面给出的值 . { ... -
1 votesanswersviews
@Document(collection =“Test”)在MongoRepository中不起作用 - Spring数据 - mongodb
我正在尝试使用java的泛型创建通用mongo存储库 . 我已经定义了如下的存储库 . public interface ICentroRepository<T extends Serializable, ID extends Serializable> extends MongoRepository<T, ID> { } 我正在定义文档实体如下 @Document...