Skip to content
Advertisement

Tag: spring

Spring Data Jpa: persisting child entities from parent entity does not update child identity

Environment: OS: Ubuntu 20.04 LTS Java: OpenJDK 17.0.3 Spring Boot: 2.6.7 MySQL: 8.0.29 Is it normal for Spring Data Jpa (or Jpa in general) to NOT update child identity attributes when the child is persisted (saved) via the parent entity repository? Consider this: When I call someClassFunction() I get: The database assigned id is NOT available to me immediately. I

Jedis does not support returning PendingMessagesSummary

When I start the spring app write with Java 11, show error like this: I have already upgrade the Jedis version to the newest 4.2.3, why still did not support the Redis pending command? I have already read the Jedis issue. They already added the pending support in the Jedis 3.6.0, why still tell me that did not support? This

Deleting an entity with one to one relation

My two entities have one to one relation I tried to delete my user entity by this method PasswordResetTokenRepository class which method I called in my service method, for deleting user I used regular hibernate method deleteById(Long id) But when I try to delete by this method I got this error: not-null property references a null or transient value :

Return link from Hateos

I have this old Spring Hateos code which I want to migrate to the latest version: I tried this: I get error at this line: Can you advise what is the correct way to implement this? Answer Based on your comments & question for migration this is what I am suggesting: …. //calling addLinlk And inside addLink: Tested with Java

Overriding transaction propagation levels for methods having Spring’s @transactional

I have multiple methods in my codebase annotated with Spring’s @transactional with different propgation levels (lets ignore the idea behind choosing the propagation levels). Example – Now I have a new use case where I want to perform all these operations in a single transaction (for this specific use case only, without modifying existing behavior), overriding any annotated propagation levels.

Advertisement