Im developing a Spring Batch application. Although I’m getting more and more comfortable with it, I came across with something that is making me very confused. Please take a look at this step configuration. As you can see it’s a pretty standard step. My confusion is related to the chunk size (50) and the reader (processNonExportedMbfsOperationsItemReader). Reader code next: The
Tag: spring-data-jpa
Spring Data JPA: What is wrong or how to correct this jpql query
The entity relationships are – A student belongs to one college And a college can have multiple students. So there is ManyToOne relationship between Student –> College And a OneToMany relationship between College –> Student. The entities are as below. and 1) I am using the below jpql query in spring data jpa repository. I am expecting that a list
How does JPA EntityGraph allow chosing the entity graph at runtime?
I have seen various post describing that JPA EntityGraph allows to choose the graph at run time. And I am not entirely clear what this refers to. Out of good faith and respect I would like to take this helpful article for reference: https://www.baeldung.com/jpa-entity-graph. (Most of JPA users might have gone through it already.) The article quotes – EntityGraph allows
JpaRepository with custom Query and Composite Primary Key: error unknown column
I have a SQL Server entity with a Composite Primary Key. That is the Entity: and this is ID Class: That is the JpaRepository But when this Query is executed I get an error: Invalid Column name: plz Answer Finally I got the solution 🙂 The select wasn’t returing the full key / object. Validation on the object failed and
Spring-Boot MVC JPA Filters
Let me start by saying I’m fairly new to Spring Boot so apologies if I’m making a silly mistake somewhere. I am trying to retrieve the value of my form post using @RequestParam so I can utilize it in a JPA query to return kids who have a specific pet type. I’ve done other JPA queries and had successful results,
How to solve Error when save Entity with List
I have next Entity(List was added with last update): And liquibase update: Well, when I try to save entity I get rg.postgresql.util.PSQLException: ERROR: relation “settings_bank” does not exist. I connect to DB by pgAdmin and- table was created.. List bankIds- just Long, its not connect to another Entity. What I missed and how to fix it? Answer I solve it,
How to set up init method with file constants for Spring Application?
I’m pretty new in Java Spring usage, so here’s my question. I need to inject some information into DB before my application starts. I mean, I know how to use @Bean init-method, but i dont’t want to hardcode constants even in .properties file. Here’s my temporary solution (data is changed): But this IS hardcode, what’s more, every client will have
Understanding Relationship Cascading with Merge
Deep diving into Spring JPA and I have troubles to understand whats going on here. This is the code: Entity SpringBootApp By starting the app, the following gets generated in the DB: I get to the point where all the persons are generated, but I would expect one additional entry in the PERSONP_KNOWS table, e.g. for p2.knownBy.add(p4); But it isnt.
JPA pagination query becomes slower with every subsequent call
Project has Spring Boot with JPA. We have a table vehicle with 1m+ records. Table has an indexed field type. We have a use case, where we want to fetch all the records by type. For each type, we get all the vehicle records, then for next type, then for next and so on. Since there are 1m+ records, we
Spring data jpa, how to filter and then sort results in this example?
I wrote a method, but as you can see – Category here is never used. Is to possible to find only Dishes where Category is same as defined and only after it – sort it by parameter using plain Spring data jpa? Or the only way to it is a custom query? Answer You could add a method like below