Skip to content
Advertisement

why does spring throw me an exception about bad sql code?

Im working in an app that has a spring boot server. the thing is that i have a query, not auto generated one, that throws me a bad sql exception and i cant seem to find out why. Also im using MySQL as a database this is my repository code :

JavaScript

The one with the @Query annotation throws me:

JavaScript

Can anyone tell me what im doing wrong? I’ve tried reworking the code but it seems to me it just doesnt

logs as requested (i think its this)

JavaScript

EDIT: I can tell is something to do with the pageable object. I mean its when there are more objects that what can fit in a page. I had pages of ten by default, and there are 12 objects, didnt work, when they fit in a single page (here i increased page size to 15) it works.

EDIT: Project and Team classes

JavaScript
JavaScript

Advertisement

Answer

Seems like hibernate is having problems generating the count statement for calculating the amount of pages of the results, might be due to the lack of an explicit definition of a joint table for your many to many relationship, in any case you can try explicitly defining a count statement for your query like this

JavaScript
User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement