spring-data

Blank Screen even though log has results for @ManyToOne Lazy associated resource

南楼画角 提交于 2019-12-25 06:50:40
问题 I am using following dependencies - <dependency> <groupId>org.springframework</groupId> <artifactId>spring-framework-bom</artifactId> <version>4.1.3.RELEASE</version> <type>pom</type> <scope>import</scope> </dependency> <dependency> <groupId>org.springframework.data</groupId> <artifactId>spring-data-jpa</artifactId> <version>1.8.0.M1</version> </dependency> <dependency> <groupId>org.springframework.data</groupId> <artifactId>spring-data-rest-webmvc</artifactId> <version>2.3.0.BUILD-SNAPSHOT<

Spring Data MongoDB NotLike - Unsupported keyword

南笙酒味 提交于 2019-12-25 06:46:07
问题 I have configured a Spring Data Repository (mongoDB) and Author entity as following : Repository : public interface AuthorRepository extends MongoRepository< Author, Long > { Iterable<Author> findByFirstName( String personName ); Iterable<Author> findByFirstNameLike( String personName ); Iterable<Author> findByFirstNameNotLike( String firstName ); } Entity Class : @Document( collection = "author" ) @Data public class Author { @Id private String id; private String firstName; //.. } I'm able to

JPA Specification complex query

倾然丶 夕夏残阳落幕 提交于 2019-12-25 06:29:03
问题 I have below data :- Product Reason Qty Pepsi IN 10 Pepsi Out 2 Pepsi In 15 Pepsi Out 5 Coke IN 100 Coke Out 20 Coke In 35 Coke Out 25 and from JPA Specification i want to execute below query something like below :- select * from ( (select SUM(QTY) from stock where reason like 'IN') as INDATA - (select SUM(QTY) from stock where reason like 'OUT') as OUTDATA ) as TBL; result will be below :- Product Qty Pepsi 18 Coke 90 I am using JPA Specification for the first time and i dont no idea how to

spring boot - neo4j - java.lang.IllegalArgumentException: argument type mismatch

寵の児 提交于 2019-12-25 04:49:16
问题 I'm having a trouble with mapping an object Employee to my database when invoking a default method in my Employee repository. I get an argument type mismatch when invoking an employeerepository.findall() method Employee repository package org.jarivm.relationGraph.repositories; import org.jarivm.relationGraph.domains.Employee; import org.jarivm.relationGraph.domains.Project; import org.springframework.data.neo4j.annotation.Query; import org.springframework.data.neo4j.repository.GraphRepository

Spring data mongoDB GeoNear query with excluding fields

点点圈 提交于 2019-12-25 04:17:45
问题 I don't know if I am doing something wrong or it is a bug. I have the following code: Query criteria = new Query(Criteria.where("locationTime").gte( "date-time")); criteria.fields().exclude("friends"); NearQuery query = NearQuery.near(point).maxDistance(maxDistance) .num(limit).query(criteria); GeoResults<Profile> result = mongoTemplate .geoNear(query, Profile.class); I am executing the query and profiles near by retrieved correctly according to distance and the "locationTime" criteria but it

Exception JPA/Hibernate: detached entity passed to persist while saving child @ManyToOne relation

二次信任 提交于 2019-12-25 04:00:37
问题 Unable to save child object reference. Employee parent object contains the child employee_detail which also has a @ManyToOne defined to save Address object. Table structure EMPLOYEE ID BIGINT(20) NOT NULL AUTO_INCREMENT NAME VARCHAR(100) NOT NULL EMPLOYEE_DETAIL ID BIGINT(20) NOT NULL AUTO_INCREMENT EMPLOYEE_ID BIGINT(20) NOT NULL ADDRESS_ID BIGINT(20) NOT NULL Entities @Entity @Table(name = "employee") public class Employee { @Id @GeneratedValue(strategy = GenerationType.AUTO) @Column(name =

error on spring data jpa with gae

孤街浪徒 提交于 2019-12-25 03:44:06
问题 I use Google App Engine and Spring Data JPA. @Entity public class Feed { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Key id; private String name; private String url; private Date created; public Feed() { } public Feed(String name, String url) { this.name = name; this.url = url; this.created = new Date(); } // Getter and Setter } @Entity public class News { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Key id; @ManyToOne private Feed feed; private String

Spring Data Neo4j “Hello, World” standalone app

主宰稳场 提交于 2019-12-25 03:43:39
问题 I'm trying to write a "Hello, World" with Spring Data Neo4j in a standalone app. It runs and actually creates the Neo4j database, but my @Autowired repo is not being initialized. I suspect the problem is in my main class, but I don't know what to try. Unsurprisingly, almost all the Spring tutorials I've found are about web apps. What am I doing wrong? config bean: @Configuration @EnableNeo4jRepositories(basePackages = "test2") public class ConfigBean extends Neo4jConfiguration { private

Hibernate Inheritance strategy=InheritanceType.JOINED & onetoMany with spring-data-jpa

感情迁移 提交于 2019-12-25 03:32:33
问题 For Some reason, I am not able to get the combination of Hibernate Inheritance strategy=InheritanceType.JOINED & onetoMany working. Following are the entities. @Entity @Inheritance(strategy=InheritanceType.JOINED) @DiscriminatorColumn(name="OBJECT_TYPE") public abstract class ExamObject { @Id @GeneratedValue(strategy=GenerationType.AUTO) private Long id; @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "examid", nullable = false) private Exam exam; } @Entity @DiscriminatorValue("Q")

How to implement custom repository based on JpaRepository in spring?

拈花ヽ惹草 提交于 2019-12-25 03:29:07
问题 Context: I used queryDSL in API controller which binds query to the database get. Currently, I have two tables with OneToOne relationship, and we can call them Table A and Table B. If there are 3 rows in A and 2 rows in B, when I get list A with some conditions, and the queryDSL will generate query SQL like A CROSS JOIN B WHERE A.id=B.a_id , but it will miss one item in A. Thus, I am going to implement custom repository to support change join type when generating the SQL statement. The