spring-data

Could not create query metamodel on simple JPA repository

拈花ヽ惹草 提交于 2020-01-04 02:50:11
问题 I defined the following repository public interface CityVerboseRepository extends JpaRepository<CityVerbose, Integer>{ List<CityVerbose> findByStreetStartingWith(String street); } corresponding to the entity @Entity public class CityVerbose { @Id public Integer id; public String street; } but all I am getting is could not create query metamodel for method public abstract java.util.List once I am trying to autowire that repository. All my other repositories work just fine... 回答1: The

Adding Schema name to entity in Spring data?

跟風遠走 提交于 2020-01-03 19:31:13
问题 I am getting an error when using an Oracle DB and Spring Data . The error is: ORA-00942: table or view does not exist The cause of this error is that the user I am connecting with does not have access to the tables in the schemas I wish to connect to. I read that 2 fixes to this are to create synonyms in my database or to specify the schema that each entity/table belongs to. I am going to try the Schema approach first. How do I do so? My example entity below, a Dog in the Vet Schema: @Entity

How to limit result in @Query used in Spring Data Repository

﹥>﹥吖頭↗ 提交于 2020-01-03 15:20:31
问题 I am retrieving data by CrudRepository in Spring Data JPA . I want to filter my records those are retrieved from my custom query provided in @Query annotation. I tried .setMaxResults(20); for select rows.. But it gives errors. I want to filter first 20 rows from my table this is my repository package lk.slsi.repository; import java.util.Date; import lk.slsi.domain.SLSNotification; import org.springframework.data.jpa.repository.Query; import org.springframework.data.repository.CrudRepository;

Save null value with Spring repository to mongodb document

血红的双手。 提交于 2020-01-03 13:41:50
问题 I want to save a null value to a document with a Spring Data Repository. So someEntity below is an object with a property set to null in java. ... repository.save(someEntity); ... Spring will save this as undefined, meaning the property of the document is not set to null. In our use case, we treat null as a proper value. How can you solve this without overriding the save() method in the repository? 来源: https://stackoverflow.com/questions/27187749/save-null-value-with-spring-repository-to

How to use Mongo with Spring Data without ObjectId

六眼飞鱼酱① 提交于 2020-01-03 13:00:49
问题 I have an existing mongo database in which ids (_id) are persisted as plain Strings.. This is sample data in Mongo DB: { "_id" : "528bb0e2e4b0442f1479f1b4", "schoolId" : "URDLKYLFJXLWJGR193778316742298", "surname" : "Lewis", "admissionNumber" : "0347", "firstName" : "Martins" } I have a Java object which is of the form: public class Student { @Id private String id; private String schoolId; private String surname; private String admissionNumber; private String firstName; } With Getters and

How to use Mongo with Spring Data without ObjectId

旧巷老猫 提交于 2020-01-03 13:00:43
问题 I have an existing mongo database in which ids (_id) are persisted as plain Strings.. This is sample data in Mongo DB: { "_id" : "528bb0e2e4b0442f1479f1b4", "schoolId" : "URDLKYLFJXLWJGR193778316742298", "surname" : "Lewis", "admissionNumber" : "0347", "firstName" : "Martins" } I have a Java object which is of the form: public class Student { @Id private String id; private String schoolId; private String surname; private String admissionNumber; private String firstName; } With Getters and

how to disable log in spring data neo4j

不问归期 提交于 2020-01-03 09:06:13
问题 I am getting unwanted query log from spring neo4j like following 25-08-2018 23:47:07.597 [restartedMain] INFO o.n.o.d.bolt.request.BoltRequest.executeRequest - Request: MATCH (n:`OntoCategory`) WHERE n.`name` = { `name_0` } WITH n RETURN n,[ [ (n)-[r_h1:`HasSynonym`]->(o1:`OntoSynonyms`) | [ r_h1, o1 ] ] ], ID(n) with params {name_0=Breakfast Items} 25-08-2018 23:47:07.610 [restartedMain] INFO o.n.o.d.bolt.request.BoltRequest.executeRequest - I am using following logging properties in my

How to I tell a Springdata-repository's delete method to not throw an exception if an entity does not exists?

梦想与她 提交于 2020-01-03 08:32:26
问题 I am using SpringData's repository. If I try to delete an entity via an ID which does not exist or never existed it throws an exception. Since I do not want to check whether the entity exists before I delete it, it would be nice that it would fail silently. It would make it easier because the observable behavior is the same - after the call the entity does not exists anymore. Whether it has been deleted or never existed, I do not care. Is there a way to modify default behavior of delete

shared drive csv file load to Mssql table using spring

≯℡__Kan透↙ 提交于 2020-01-03 06:39:31
问题 I am searching for approach/ code base which can fulfill the below requirement. We have source file(formatted) in shared drive which has ~one million record count, this drive has new file every day with date prefix on it(eg: 02-12-2018_abcd.txt) 2.While reading file from sharedrive location, if its any failure occuer it should not commit the sql insert. 3.this job should run on schduled time. I found the couple of approaches to read file from shared drive like jar to read, another approach is

Custom repository implementation for Neo4j doesn't work

邮差的信 提交于 2020-01-03 05:52:06
问题 This is similar to what is discussed at Unable to use two Neo4j Instances with Spring boot/Spring data neo4j but I don't have two databases. I have downloaded the spring-data neo4j sample java application from the git repo and want to execute a dynamic query instead of executing a static query via repository interface. I am facing an issue of null transaction manager. Here's my interface : public interface SearchRepositoryCustom { Iterable<Movie> searchByCriteria(); } Here's my custom repo