spring-data

Spring Data JPA Transaction - No Transaction in progress - Spring Data Neo4j

北城余情 提交于 2020-01-17 01:58:06
问题 I think i'm missing something obvious. Iam trying to make a entity persist into a database via a JUnit Test case, however it doesnt seem to be persisting due to no active transaction. Configuration: @Configuration @EnableTransactionManagement public class TransactionConfig { @Inject private EntityManagerFactory entityMangerFactory; @Bean public JpaTransactionManager transactionManager(){ return new JpaTransactionManager(entityMangerFactory); } TestCase: @RunWith(SpringJUnit4ClassRunner.class)

Regular & Spring Data based cache operations fail with CacheStoppedException post manual reconnect with clientReconnectDisabled as true

喜欢而已 提交于 2020-01-17 01:44:06
问题 We are running version 2.4 & using Spring IgniteSpringBean & Spring Data repositories for cluster & cache access. Since we have been having a lot of IgniteClientDisconnectedException related issues, i am writing a manual segmentation resolver (by disabling automatic client reconnection with clientReconnectDisabled set to true) which would detect this condition (using a simple cache query that runs periodically) & initiate a disconnect via IgniteSpringBean#close followed by a reconnect with

Hibernate Envers: prevent version on onPostDelete

我们两清 提交于 2020-01-16 19:36:11
问题 I would like to stop Hibernate Envers from creating a version if the audited entity is deleted. The issue is, that instead of an delete version (REVTYPE: 2) and updated version (REVTYPE: 1) is inserted without calling onPostUpdate Event of Envers. pom.xml: <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0

Hibernate Envers: prevent version on onPostDelete

拥有回忆 提交于 2020-01-16 19:36:07
问题 I would like to stop Hibernate Envers from creating a version if the audited entity is deleted. The issue is, that instead of an delete version (REVTYPE: 2) and updated version (REVTYPE: 1) is inserted without calling onPostUpdate Event of Envers. pom.xml: <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0

QueryDsl SQL - Left Join a subquery

十年热恋 提交于 2020-01-16 18:13:11
问题 I am using QueryDsl SQL and I want to left join a subquery. Here is the query in plain SQL SELECT usr.memberId, payoutsBbf.totalPyts FROM users usr LEFT JOIN (SELECT pyt.member_id AS mmb_id, SUM(pyt.amount) AS totalPyts FROM payout pyt WHERE pyt.payoutPeriod < '2018-01-01' GROUP BY pyt.member_id) AS payoutsBbf ON usr.id = payoutsBbf.mmb_id I wish to write it in QueryDsl SQL and is almost important that the subquery is left joined to the main table users coz this is just a snippet of the whole

spring data mongodb query document

左心房为你撑大大i 提交于 2020-01-16 11:57:31
问题 I am facing this issue(getting null response) when i am trying to Query in Java using I need to based on placed time stamp range and releases desc and status. // My document as follows: <ordersAuditRequest> <ordersAudit> <createTS>2013-04-19 12:19:17.165</createTS> <orderSnapshot> <orderId>43060151</orderId> <placedTS>2013-04-19 12:19:17.165</placedTS> <releases> <ffmCenterDesc>TW</ffmCenterDesc> <relStatus>d </relStatus> </releases> </ordersAudit> </ordersAuditRequest> I am using following

The constructor Sort(Sort.Direction, String) is undefined

99封情书 提交于 2020-01-16 08:46:31
问题 I want to use Spring Data JPA with default sort direction with the latest spring-boot-starter-parent 2.2.1.RELEASE: @Override public Page<ProcessingLogs> findAll(int page, int size) { return dao.findAll(PageRequest.of(page,size, new Sort(Sort.Direction.DESC, "createdAt"))); } But I get error: The constructor Sort(Sort.Direction, String) is undefined This is the latest code: https://github.com/spring-projects/spring-data-commons/blob/master/src/main/java/org/springframework/data/domain/Sort

spring data elasticsearch - settings using config file

孤者浪人 提交于 2020-01-16 04:09:12
问题 I am using elasticsearch for my application and this the domain entity @Document(indexName = "bookstore", type = "book", refreshInterval = "-1") public class Book { @Id @Column(name = "ID") private Long id; @Column(name = "NAME") @Field(type=FieldType.String) private String name; @Column(name = "DESCRIPTION") private String description; @Column(name = "PRICE") private Double price; This is the config file @Configuration @EnableElasticsearchRepositories(basePackages = "elasticsearch.repo")

Entity manager best practices

↘锁芯ラ 提交于 2020-01-15 12:09:28
问题 I would like to know which way is the best to define entity manager. I am using spring boot case 1) creating in spring service class like follows @Service @Transactional public class DemoService { private static final Logger log = LoggerFactory.getLogger(DemoService.class); private EntityManagerFactory emf; public void getEntity(){ final EntityManager em = emf.createEntityManager(); } @PersistenceUnit public void setEntityManagerFactory(final EntityManagerFactory emf) { this.emf = emf; } }

$addToSet implementation for array update on PATCH request

╄→гoц情女王★ 提交于 2020-01-15 09:46:06
问题 Is there a way to tell MongoRepository to implement $addToSet when updating an array value during PATCH request? I am using Spring data rest with HATEOAS and Mongodb, and the current implementation replaces the old array with the new array, where the desired functionality is to perform a union of both arrays and have that array stored in the Mongodb document. While it should be possible to do that with custom implementation, Spring won't generate a rest url for the implementation and hence