I’m super rusty with databases and haven’t got the chance to work too much with them in the past 6-8 years, so there are some things that are uncertain for me. Let’s assume I have a simple bi-directional one-to-many situation: and and I want to perform a query which will return all the parents together with the matching children that
Tag: hibernate
Complex SQL Query For Counting and Listing
I need to write complex sql for counting distinct names popularity and sorting them with descending order. I’ll do this with hibernate @Query(“SELECT * FROM …”) parameter. First I tried to do it on SQL then implement it to my spring boot project but I’m stuck while writing it. Sorted version: Answer I think you are looking for group by.
Schema-validation: wrong column type encountered in column
Error: Schema-validation: wrong column type encountered in column [curr_step] in table [risk_workflow]; found [varchar2 (Types#VARCHAR)], but expecting [number(19,0) (Types#BIGINT)] Please let me know how can we solve this? Column declaration in entity class “risk_workflow” WorkflowTaskRoleMapping entity: Answer The id of WorkflowTaskRoleMapping is a long and Hibernate maps it on the db with a column of type number(19,0). Hibernate expects the
Invalid path in HQL and weird substitutions
I hope you can help me with this. I am working on the upgrade of a customized installation of DSpace from 5.5 to 6.3 and I am running into a weird issue with HQL. The SQL that I am trying to implement is this: and this is the HQL that I wrote in my code and it is supposed to
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
Deadlock when we we have dependent entities in hibernate and try to update table using multiple threads in Vertica
I have two java classes. Father.java and Children.java I receive the Deadlock X exception if several threads visit the same table (entity father) to updates with distinct row entries, even though the records are different. Is there any way to fix why the entire table locks up instead than just one row? Even though I haven’t updated or added anything
Undefined filter parameter in Hibernate
I am trying to map a LocalDate to a SQL Date, but am receiving this error: java.lang.IllegalArgumentException: Undefined filter parameter [afterDateLocal] I can’t provide a reproducible example, but here’s the code of the ListingRepositoryImpl: And the filters defined on the entity listing: I am using Hibernate 5.5.7 so I expect LocalDate to work. Answer date was not defined in the
Hibernate – make id value be able to be autogenerated directly in datasource as well
I’m making a Spring boot application with Hibernate ORM framework. I have an @Entity class in my code: I successfully can persist a Thing to my datasource. And thing_id is generated as expected. But I cannot insert a record directly in database manager (e.g. DataGrip): I have a warning and appropriate error when trying to insert: So how can I
How to ignore 00 (two leading zeros) in Select query?
I am not sure whether it is possible or not, I have one DB table which is having fields refNumber, Some of this fields values contains two leading zeros, following is example. id. refNumber 10001 123 10002 00456 Now I am trying to write a query which can select from this table with our without leading zeros (Only two not
Order by 2 columns with case
I have a query that searches for user in 2 colums firstUser and secondUser and orders them by first and last name: But this first orders the cases when user is at first user then it orders the case when user is secondUser. Is ther a way to order the whole data by first name and last name no matter