Relative Content

Tag Archive for javaspringspring-boothibernatejpa

Spring Data JPA OneToOne ON DELETE SET NULL

I have two entities for RfidTags and Persons. One RfidTag is assigned to one Person. One Person can have one RfidTag. If I delete a Person that has an RfidTag, the assigned RfidTag should not get deleted, it should remain in the database, but the value for person_id should be set to NULL. I already have my SQL like this, but it is not working:

I’m consistently facing error org.springframework.beans.factory.UnsatisfiedDependencyException

It’s saying org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘productController’: Unsatisfied dependency expressed through field ‘service’: Error creating bean with name ‘productService’: Unsatisfied dependency expressed through field ‘repo’: Error creating bean with name ‘productRepo’ defined in com.example.ecomwebsitejava.repo.ProductRepo defined in @EnableJpaRepositories declared on JpaRepositoriesRegistrar.EnableJpaRepositoriesConfiguration: Could not create query for public abstract java.util.List com.example.ecomwebsitejava.repo.ProductRepo.searchproduct(java.lang.String); Reason: Validation failed for query for method public abstract java.util.List com.example.ecomwebsitejava.repo.ProductRepo.searchproduct(java.lang.String)

I’m consistently facing error org.springframework.beans.factory.UnsatisfiedDependencyException

It’s saying org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘productController’: Unsatisfied dependency expressed through field ‘service’: Error creating bean with name ‘productService’: Unsatisfied dependency expressed through field ‘repo’: Error creating bean with name ‘productRepo’ defined in com.example.ecomwebsitejava.repo.ProductRepo defined in @EnableJpaRepositories declared on JpaRepositoriesRegistrar.EnableJpaRepositoriesConfiguration: Could not create query for public abstract java.util.List com.example.ecomwebsitejava.repo.ProductRepo.searchproduct(java.lang.String); Reason: Validation failed for query for method public abstract java.util.List com.example.ecomwebsitejava.repo.ProductRepo.searchproduct(java.lang.String)

Why is spring not inserting value into ID column

I am trying to successfully map two classes in an OneToOne relationship; mainly because my User class needs two Ids that are GeneratedValue. I’ve used Lambook for getter setters and constructors ; I’m using postgres as database.