Skip to content
Advertisement

Tag: one-to-one

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 :

Spring – how to automatically insert an entity in the database when inserting another (One-To-One relationship)?

Hi fellow software developers, Let’s assume we have the following scenario: we have a system where drivers can register. Each time a new Driver registers, the system automatically builds and assigns a Car to the driver. Let’s consider we have the following rest controller which exposes an endpoint for the drivers to register in the system: How would you Actually

One to One relationship mapping JPA SpringBoot implementation error: ids for this class must be manually assigned before calling save()

I am trying to understand the JPA Spring Boot implementation for One-to-One mapping classes and was hoping if anyone could provide me a clear picture. One to One mapping Scenario: Table foo and Table childfoo Foo has the columns foo_id,foo_name, foo_place childfoo has the columnd foo_id(foreignkey of foo table), childfoo_name Here is the JPA entity implementation I’ve made so far:

Advertisement