Skip to content

Tag: spring-boot

Delete cascade Category child (Java Hibernate JPA)

I have this Entity to represent a Category system with a selfrelationship to get child categories: The problem is when I want to delete a category that has child categories. I want to delete all child categories but Java drops me this exception : Cannot delete or update a parent row: a foreign key constraint …

Boolean value not being changed in database

Hey folks I’m having a problem with my code. For some reason when I try to change the value to false, it doesn’t reflect in my SQL Database. I debugged and it does get set via Java, but it doesn’t transfer over. I’m working on a notification service class and it sets the values on ther…

Create new PostgresSQL schema

What’s the easiest way to create a new Postgres scheme inside the database on the runtime and also, create the tables written inside a SQL file? This is a Spring boot application and the method receives the schema name that needs to be created for the db. Answer Although it sounds like this would be a c…

Problems with JPA Hibernate Query with ‘Interval’

I need the possibility to retrieve the orders for the past 6 months for my backend application. After some research , I’ve found out that JPA does not support the INTERVAL definition. Is there a workaround for archiving this particularly function ? Answer In that case use the JPA provided functionality …