-
6 votesanswersviews
Liquibase从JPA实体生成更改日志
我有一个Spring引导,spring数据jpa项目,父项和三个子模块 . 我的一个模块负责我的JPA实体 . 我需要从这个实体生成一个带有liquibase的xml更改日志 . 在我的liquibase.properties中我有代码: changeLogFile=src/main/resources/db/changelog/db.changelog-master.xml url=jdbc:m... -
0 votesanswersviews
Spring Data MongoDb - 手动引用ObjectId到String
假设我有一个User类,其中包含对客户文档的手动引用: public class User(){ @Id public String id; public String name; public String customerId; } 我希望id和customerId都存储为mongo中的ObjectId . 保存用户文档时,“id”将转换为ObjectId,但... -
177 votesanswersviews
如何在Spring Data中使用OrderBy和findAll
我正在使用spring数据,我的DAO看起来像 public interface StudentDAO extends JpaRepository<StudentEntity, Integer> { public findAllOrderByIdAsc(); // I want to use some thing like this } 在上面的代码中,注释行显示了我的意... -
1 votesanswersviews
Apache Ignite,Spring数据和mysql不能一起工作
我已经发布了项目 https://github.com/armdev/ignite-spring-boot 使用Spring数据JPA,Mysql和Apache Ignite配置 . 这是Ignite缓存配置 @Bean public Ignite igniteInstance() { IgniteConfiguration cfg = new IgniteConfig... -
0 votesanswersviews
spring批处理导致spring数据不提交事务
我有一个spring mvc应用程序,它有一个由spring批处理的批处理程序 . 如果我删除批处理配置,则提交所有事务 . 如果运行批处理作业,批处理作业将成功完成,但数据不会提交到数据库,我的配置如下所示 @Configuration @EnableWebMvc @EnableAsync @EnableScheduling @EnableBatchProcessing(modular = fa... -
1 votesanswersviews
Spring数据jpa嵌套事务回滚没有删除插入?
我尝试在事务中的数据库中插入2条记录 . 第二个插入失败,但在回滚中,第一个插入不会被删除: @Resource private WebMessageRep rep; //<-- extends JpaRepository @Transactional public void test() { WebMessage wm = new WebMessage(.vali... -
1 votesanswersviews
Spring Boot - 如何在单个POST请求中创建实体和嵌套实体
我试图用Spring Data弄清楚具体的事情,那就是:如何用一个POST请求创建一个实体和一个相关的实体 . 我可以创建具有单独请求的相关实体,但是单个请求我不确定 . (没有创建特定的控制器方法) . 例: ReusableComponent.java @Entity public class ReusableComponent { @Id @GeneratedV... -
1 votesanswersviews
定义哪个实体管理器与JpaRepository关联
我正在编写一个Spring Boot应用程序,它有多个dataSources和entityManagers,我想使用JPA CrudRepository接口,如: @Repository public interface Car extends CrudRepository<Car.class, Long> {} . 我收到以下错误: 创建名为'carRepository'的bea... -
3 votesanswersviews
如何在Spring Data JPA中使用多个JPA持久化上下文?
我需要两个持久化上下文来管理不同数据库中的实体 . 我使用基于java的配置与spring 4.1.4,hibernate 4.3.7和spring data 1.2 . 基本上,CompanyApplicationContext导入两个持久化上下文:PersistenceContext和SharedDbPersistenceContext . 每个持久化上下文都有自己的数据源,事务管理器和实体管... -
1 votesanswersviews
具有嵌套复合主键实体的Spring Data JPA Persisting Entity本身是一个在持续时间分离的嵌套实体
我有三个jpa实体,我正在努力合作 . BoxProfile,BoxProfileItemAssignment和BoxItem所有代码如下所列 . BoxProfileItemAssignment使用@MapId的@EmbeddedId来映射复合键 . BoxProfile有一组BoxProfileItemAssignments,赋值是BoxItem和Quantity值 . 我希望能够在持久化... -
3 votesanswersviews
具有动态字段的Spring Data Solr无法正常工作
我试图用动态字段索引文档并定义它: @SolrDocument(solrCoreName = "collection1") public class SolrProduct { @Field String id; @Field String name; @Field("mappedField_*") Ma... -
9 votesanswersviews
Spring Boot和Spring Data应用程序,在运行时创建了多个DataSource
我正在开发一个使用Spring Data JPA的Spring Boot应用程序,需要连接到许多不同的数据库,例如PostreSQL,MySQL,MS-SQL,MongoDB . 我需要在运行时创建所有数据源,即用户在启动的应用程序中通过GUI选择这些数据:-driver(列表中的一个), - source,-port,-username,-password . 毕竟他写本机sql来选择数据库并... -
1 votesanswersviews
具有多个数据源和外部配置的Spring Boot,Spring JPA
我有一个简单的Spring Boot应用程序,带有2个外部jar . 每个jar都使用Spring JPA,并且完全配置为独立工作 . Jar1 JPA存储库 @Repository public interface QuarterRepository extends JpaRepository<Quarter, Long>{ } Entity @Entity public cl... -
0 votesanswersviews
如何在spring数据休息中添加自定义状态代码
我在做Spring Data REST . 按照这里描述的简单示例开始:http://spring.io/guides/gs/accessing-data-rest/我有一个我正在考虑的问题 . 查询“curl http://localhost:8080/people/search/findByLastName?name=Baggins”将返回HTTP状态200,(确定)即使未找到任何结果(jso... -
0 votesanswersviews
如何对全局二级索引DynamoDB进行排序
Data-REST和dynamoDB并尝试按如下方式对我的GSI对象进行排序,是否可以在dynamoDB中对GSI Hashkey进行排序, Domain class @DynamoDBTable(tableName = "test") public class Test implements Serializable{ private static final lo... -
1 votesanswersviews
org.hibernate.PersistentObjectException:未初始化的代理传递给persist()
当我尝试在注册期间保存用户对象时,我得到以下错误 UserService > @Service public class UserServiceImpl implements UserService { > > @Autowired > private UserRepository userRepository; > > @Autow... -
3 votesanswersviews
使用spring-data-cassandra从Cassandra DB保存/加载时的前/后过程对象
我正在使用spring-data-cassandra 1.1.2.RELEASE通过spring数据存储库将对象映射到Cassandra DB . 我有一个特殊要求,即密码类属性必须在数据库中加密,并且必须在从DB加载数据时解密 . 我们在使用spring-data-mongo并通过 AbstractMongoEventListener 添加自定义事件侦听器之前已经完成了这一点,我们在对象读/写数... -
0 votesanswersviews
如果POJO的键是复合的,则Spring Data Cassandra不映射JSON请求
我正在尝试将请求保存到Data Stax-Cassandra . 组件:EventController:@RestEndPoint OneKeyClass:对于复杂键(具有多列)我使用标准Spring存储库模型来保存和获取数据 . Gradle: plugins { id "org.springframework.boot" version "1.5.3.RE... -
26 votesanswersviews
com.datastax.driver.core.exceptions.InvalidQueryException:unconfigured table schema_keyspaces
我正在尝试使用cassandra配置spring数据 . 但是当我的应用程序在tomcat中部署时,我收到了轰鸣声错误 . 当我检查连接时,它可用于给定端口 . (127.0.0.1:9042) . 我有下面的堆栈跟踪和 spring 配置 . 有没有人对这个错误有所了解? 完整堆栈跟踪: 2015-12-06 17:46:25 ERROR web.context.ContextLoader:3... -
0 votesanswersviews
Cassandra UDT VerifierMappingExceptions
我正在开发spring boot应用程序 . 它连接Apache Cassandra DB . 我在Cassandra创建了UDT . 尝试使用CassandraOperations保存数据时 . 我越来越异常了 . 我已经按照以下示例了解了Cassandra UDT . http://www.devjavasource.com/cassandra/cassandra-udts-java-exam... -
0 votesanswersviews
Spring Data for Apache Cassandra中的Repository.findAll()将输出错误“参数类型不匹配”
我用CQL创建了两个表给Cassandra . 我使用org.springframework.data.cassandra.repository.CassandraRepository . 在一个表(memobox)中,repository.findAll();可以成功获取,在其他表(部门),repository.findAll();无法成功获取,并输出以下错误 . 有什么好建议吗? ■项目结构 ... -
2 votesanswersviews
Cassandra spring 数据
我正在使用spring-data-cassandra,需要使用jss映射一个字段,在cassandra中的类型为 frozen<map<text, list<text>>> 表脚本: create table IF NOT EXISTS test ( id varchar, name varchar, target frozen<map<text, ... -
0 votesanswersviews
为什么Cassandra在多次插入时会使用唯一主键挂起某些行?
这是将在cassandra数据库上创建表的实体类 . @Table public class Log { @PrimaryKeyColumn(ordinal = 0, type = PrimaryKeyType.PARTITIONED) private LocalDate date; //partition key @PrimaryKeyColumn(ordinal = 1... -
6 votesanswersviews
使用Spring Data JPA,JpaRepository和CrudRepository之间究竟有什么区别? [重复]
这个问题在这里已有答案: What is difference between CrudRepository and JpaRepository interfaces in Spring Data JPA? 3个答案 我正在使用 Spring Boot 应用程序,它使用 Spring Data JPA (在Hibernate 4上)来访问我的数据库 . 我的疑问与 DAO 接口有关(JPA用于... -
6 votesanswersviews
Spring Data JPA无效的page.sort参数
在使用Spring Data JPA和Hibernate的Web应用程序中,我们利用web pagination功能在各种实体列表中提供分页和排序功能 . @Controller public class MyEntityController { @RequestMapping(method = RequestMethod.GET) public ModelAndView list(P... -
1 votesanswersviews
Hibernate:Spring jpa存储库中按字段排序的额外交叉连接
当添加一些嵌套的字段对象时,我有一个Spring JPARepository的问题 . 在控制器中's called a method with param Pageable, contained sort == ' parent.shortDescription ASC and shortDescription ASC ' . 在Pageable之后转到 mapObjectDao.findBy... -
0 votesanswersviews
SpringData - 通过连接表进行排序,在第一个表中没有重复
我有 PersonEntity 与 AddressEntity 的 oneToMany 关系 . 另外,我已经定义了 Specification<PersonEntity> 和 Pageable 个对象 . 我的可分页对象按 addresses.city 排序 . 没有排序我有适当的结果,但如果按城市排序我在返回页面中有重复 . 如果我添加到我的规范 query.distinct(tr... -
1 votesanswersviews
Spring Data JPA - 使用@Query与多对多关系/连接表
我有一个与Role实体具有多对多关系的User实体 . @Entity @Table(name = "auth_user") public class OAuthUser { // @Autowired // @Transient // private PasswordEncoder passwordEncoder; // @Id ... -
3 votesanswersviews
Neo4j节点持久性问题就简单的用例而言
我正在实现一些测试样本来学习neo4j和spring数据,感谢cineast项目和其他样本,比如spring-data hello-worlds ...... 不幸的是我现在面临的一个问题我不明白,即使我已经花了一些时间在我的代码上的eclipse调试器和其他示例代码尝试compage,所以找到一个解决方案 . 这个问题对我来说特别受阻,因为我无法验证Neo4j的持久性,即使它真的应该是一个微不足... -
0 votesanswersviews
spring data neo4j使用现有的数据库
我正在使用Spring Data Neo4j,在Spring中创建了一个应用程序 . 我可以在JUnit测试用例的帮助下运行我的应用程序 . 但每次运行我的测试用例时,它都会在使用 <neo4j:config storeDirectory="target/neo4j-db"/> 指定的目录路径中创建一个新数据库 . 这将在我的工作空间存在于Eclipse中的相同位置...