I have an entity with some nested entities like this with entity2 and entity3 like this: Both Entity2 and Entity3 have values stored in the database so when I’m doing an insert on MyEntity, I’m doing this: it works fine, the data are stored correctly in the DB with the correct foreign keys BUT… After insert I want to build
Tag: spring-data-jpa
Spring boot application is not getting installed when 2 jvm are running on Unix server
I have 2 application both are connected to DB2 using jndi and are installed on same jboss location but on different JVM. both are having different jndi name as well but it’s connected to same db and same user. While starting server if one app is up, we are unable to install 2nd application. Can this be spring boot DB2
What is a good way to handle an Optional object returned by a Spring Data JPA repository in a situation like this?
I am working on a Spring Boot application. Into a service class I have this service method: As usual it is calling the Spring Data JPA findById() method returning an Optional object. I am returning the User object. And here I have the following doubt: if the Optional is empty, it is throwing an exception when I this operation is
Kotlin CLOB to String
I have a function in Oracle that returns a CLOB. In Java I can use the following code to execute this function and fetch the result: Oracle function definition in my Repository class: Conversion to String: What’s the equivalent code in Kotlin or any other way to convert the Clob to String? Answer It’s absolutely legal use @Query annotation in
“No qualifying bean” for repository in Groovy Spring JPA application
I know there are a bunch of similar questions on this topic, however all of them that I’ve found so far are either not quite my situation, or refer to one of the following solutions that from what I’ve read is either outdated or inapplicable: @EnableJpaRepositories annotation – taken care of by @SpringBootApplication @Repository annotation – not needed when extending
Spring Boot CrudRepository not saving entities to my database
I’ve been at this for a few hours now and can’t seem to find the issue. For a bit of context, here is my database schema : Here is my Student class : And here is my Task class : My H2 Database structure therefore looks like this : I am trying to add a task to a student through
NamedQuery returning entities with null fields
defined entity with namedquery as SELECT mdl FROM tbl_slots mdl where mdl.test_date between :dt and :dt order by mdl.test_time asc if used * instead of mdl in query, JPA gives error unexpected token: * if mentioned the column names in select statement it returns entities with respective fields populated with expected values [{ “srNo”: 1, “testDate”: “2021-Dec-30”, “testTime”: “09:00-10:00”, },{
PostgreSQL query works on pgAdmin but not in Spring Boot
The query SELECT * FROM books WHERE (isbn || ‘ ‘ || author || ‘ ‘ || name) ILIKE ‘%el%’ returns from the full db when executed in pgAdmin (PostgreSQL tool) But the same query doesn’t seem to work when I try to run it in Spring Boot, it returns an empty list. I do not know if my query
Make a POST with JPA with existing data
I have the following problem, the thing is that I have an entity: The thing is that this back is connected to an Oracle DB, in which I already have a few registered users, but these are entered through a Mockaroo script, and when I try to save a new user through a service Rest throws me this error: Of
Failed to load ApplicationContext for a java based config test
I want to test the Repository-Layer of my SpringBootApplication, but it fails to load application context. By the way I am using Java 17. Here is the error Here is My simple test class. Here is the application.properties file And finally here is my pom.xml Configuration for webclient bean I checked out different Spring-boot-test annotations like @SpringBootTest, but nothing changed.