Relative Content

Tag Archive for javaspringspring-data-jpa

Jpa query much slower with VPS DB compared to local DB

List<UserAttempt> findAllByAssignmentIdInAndIsLatest(List<Long> assignmentIds, Boolean isLatest); jpa query when i am calling it through local server and to local DB with same data as VPS taking 400 ms but when my server connected to vps calling it ,it is taking 6 sec+. java spring spring-data-jpa

How to implement sorting in Spring boot application

I have a controller that accepts optional parameters “sort” and “order”. If this params is not passed, I need to sort results from database by 2 columns, “firstName” and “lastName” DESC.
How to implement this logic? The example will be perfect.
DB is postgresql.

Register specific queries, why JPA see r and R as a one character

I have an entity Team with field String name
In my service i try to rename the teams, if there is already a team with that name i just throw an exception AlreadyExists. The problem is that when I try to rename team named Clear to CleaR JPA method findByName finds by name ‘CleaR’ this team ‘Clear’ (so i can;t rename it)
This issue acquires only with letter R, others are ok