Skip to content

Tag: jpa

Spring boot and jpa query @P0

I’m trying to run the following query but I keep getting the syntax error @P0, I also tried not to use parameters but “?” and still not working, my guess is that the string is not placed under ” and it ends up just next to bulk, but as soon as I place the single quote I get the error

Create relationship between 2 tables JPA

Need help with setting up table relationships. So, there are 2 entities – Section and Period. 1 Section has many Period, but 1 Period do not belongs to any specific Section. I implemented this relationship as follows: created an additional table SectionCodes with an external key on Section (more in diag…

use desc as a field name in Spring boot entity class

The table was not being created for the following model despite following the correct procedure Model Answer So I was creating an entity class for JPA where there was a field name desc. I was using MySQL database. But for some reason, I was getting the following error. The model Later I changed the field name…

How to include CHECK in JPA @Column columnDefinition?

I am trying to figure out syntax for columnDefinition in Column annotation when i want to add CHECK. So far what i have tried: Using JPA 2.2 (JavaEE 8) and openjpa as jpa provider. Could not find anything in docs: https://javaee.github.io/javaee-spec/javadocs/javax/persistence/Column.html Error i am getting: …

JPA Subquery fails

Does anyone know why it fails? It does not give syntax problems but it gives me the error “missing expression (ORA-00936)” The problem seems to be in :user IN uc.users Answer I think the last bit is incorrect. This should work: So, the whole query becomes:

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 …