I am currently working on a project where I have created the following custom Repository: The print statement “I got called with: ” never gets called. So for whatever reason Spring Boot is not running the method through my custom implementation. Any suggestions? Any help is much appreciated Edit: Here is the code that injects and uses the Repository in
Tag: spring-data-jpa
Best way to save and update entity Parent and child using spring data jpa
I’m facing some behaviour about spring data jpa and I need to understand. consider this : Document Template Service First => I created the template And When I created a new document for instance with this data configuration I’m getting this error detached entity passed to persist. So to resolve this error I put CASCADE Merge instead ALL on Parent
Spring JPA/Hibernate – OneToMany bi-directional problem
I’ve encountered this problem that won’t let me sleep I have 2 entities Property and Tenant each property can have 0..1 tenant, each tenant can have 1..N properties what am I trying to accomplish is when I create a new tenant, using cascading I want to attach it to an existing property saving is done via JpaRepository.save(Tenant) for example first
Get values from User and update into mysql database in Springboot Controller
I’m developing a Banking system Project Where User Should be able to create an account in any available branch. Branch Creation will be maintained by admin. I had two tables(Entities) like BranchDetails and AccountDetails. The BranchId Column is the primary key in BranchDetails and Foreign key in AccountDetails. Now When user Creates an account, he will input the Preferred Branch
How to insert all enums into database?
We have a list of ENUMS for different purposes. Sample Enum: we use .sql file to save this enums, Problem: We need to write values two times (One in enum and another one .sql statement) It seems not efficient way, Is any other way to save ENUMS to avoid this repetition? Answer From the above mentioned details what I understood
Query on distant/not directly related entity
I’m trying to create a query with a where clause on a not directly related table. My table/entity structure looks like this: I have got an entity Entity with a ManyToOne relation to Relation. Relation has a ManyToMany relation to DistantRelation. I have a JpaSpecificationExecutor<Entity> on which I call findAll() with a Specification<Entity>. How do I setup my entity and/or
Design pattern for Java Spring data JPA projects [closed]
Closed. This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 9 months ago. Improve this question This is my current project design Controller-> service -> Repository I am trying to understand : What layer(Name) i can
Jpa unit test – Service – entity manager null
This is what I tried: the error that I get is ‘ Runner org.junit.internal.runners.ErrorReportingRunner (used on class com.unibuc.AWBD_Project_v1.services.ServiceTest) does not support filtering and will therefore be run completely. Test class should have exactly one public zero-argument constructor’ Here is the LocationService: Answer Hello there is 3 issues in your test code. 1 you should remove the EntityManager entityManager from your
Failed to read candidate component class when testing Spring Data Repository – IndexOutOfBoundsException
I’m trying to test a Spring Data JPA repository but when I run the test I always get the following error The class it talks about is a pretty simple entity If I comment the @Table annotation I get the same error on the next class. I also had the issue on a classe with @Cacheable and it gave me
How to automatically generate id in sequence in spring jpa?
I need to make a one-to-many sequence as follows: for example: category sub category 1 1 1 2 2 1 2 2 2 3 3 1 Data model: enter image description here Java code/Mapping: Category class SubCategory class With the code above, I’m getting the following result: category sub category 1 1 1 2 2 3 2 4 2 5