Trying to update a record in a database but getting this error: Code below is responsible for inserting it Im not sure if there is a type issue with propId being a Long or if i have written the SQL paths wrong or both. Answer You’re trying to execute an SQL query as JPQL. There are a couple options to
Tag: jpql
JPQL query that give me the highest value
I’m trying to do a JPQL query that give me the highest PK of the PKs in my table (https://drive.google.com/file/d/1_kaklkKdCbhT0-byqCtz6HgfluKKp8J-/view?usp=sharing). Here is my query : The error says that the syntax of my query is wrong. Can someone please help me ? Thank you for your help 🙂 Answer Thank you for your comments ! It allowed me to solve
Showing a specific JSON response for my GET endpoint
I have a many-to-many relationship between Department and Employee I have already done a mapping for the GET endpoint which returns a list of departments that contain Employees, this is the request: http://localhost:8080/api/departments/1/employees, and this is the response I get: This is the code that gets the job done: Department Repository Imp Employee Service Impl Department Controller Now what I
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 Create an interface for a custom
Does the data type used in JPA entity class for defining a column impact the creation of a query in DAO?
In java entity class, I defined a named query and data types for columns. I executed the query in a DAO class but got the error: java.lang.IllegalArgumentException: Type specified for TypedQuery […
Select the top row in JPQL without using native query option
How is it possible to select the first row at the top of the selection without using native query option in JPQL/JPA? @Query(“select e from FOO e order by e.orderNumber desc”)
Load child collection DTOs in JPA DTO projection query
I’m using Java EE 7 with Java 8 and Hibernate (5.0.X) on Wildfly 10.1.0-Final, and I need to load a a JPQL query result into DTOs using projections, but I can’t find any documentation on how to load the child collection DTOs as well. For instance, if I have following entities for User, Role, and Privilege: And I want to
Unexpected empty result using spring query method
I am building an application with a REST API using spring boot and JPA connected to a MySQL database. To search for names in the User class I have implemented a query method: List< User > findByFirstnameLike( String name ); This method only returns a result on an exact match, which is not what I wanted. Have I misunderstood something
Does TransactionAttributeType.NOT_SUPPORTED make sense for retrieving entities?
Does having TransactionAttributeType.NOT_SUPPORTED on every DB lookup method makes sense? I don’t see the point in having the entity attached if it’s not going to execute an update. @…
How can I avoid the Warning “firstResult/maxResults specified with collection fetch; applying in memory!” when using Hibernate?
I’m getting a warning in the Server log “firstResult/maxResults specified with collection fetch; applying in memory!”. However everything working fine. But I don’t want this warning. My code is My query is Answer Reason for this warning is that when fetch join is used, order in result sets is defined only by ID of selected entity (and not by join