Skip to content

Tag: jpa

How use generic entity name in JPQL

I have three tables with same column name and types, what changes is just the table name. Example: | TABLE1 | TABLE2 | TABLE3 | | —— | —— | ——- | | ID | ID | ID | | NAME | NAME | NAME | | FOO | FOO | FOO | | BAR | BAR | BAR |

Passing a query as a query parameter in JPQL Native Query

I’m trying to pass a query as a string parameter in another JPQL native query. So the resulting query would be something like the query below that returns me a value but what I’m getting in return is only the string of :query parameter and not the result of the executed complete query. Answer Crea…

How to check UUID null value in JPQL?

I am using JPA/Hibernate. So I wanna to do nullCheck in JPQL, but when I do that it does not determine dataType. JPQL Query: EXCEPTION: Caused by: org.postgresql.util.PSQLException: ERROR: could not determine data type of parameter $1 at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecu…

Java code refactor with stream Collectors.groupingby()

I try to get a Map with Collectors.groupingBy() but I have no idea how to create… I have a List from jpa jquerydsl the data is like [memberId=1, departmentId=1] [memberId=1, departmentId=2] [memberId=2, departmentId=3] [memberId=3, departmentId=4] this is my Member class I want to parse tuple list to me…

Who should be parent in spring JPA relationship

I have 3 tables book, publisher, author. Here author and publisher can refer to same record in book therefore I decided to make book as relationship parent. However I also want to make it so that if a publisherA is deleted, all the book record related to publisherA also get deleted. same goes for author. I tr…