Skip to content
Advertisement

Tag: jpa

Convert to DTO from join selection

I have these two tables And I am using this query to get the results So far this is the only way I could retrieve the results and actually use them later. To use them I am using this code currently But using it that way seems odd to me. Is there a better way to directly map the result

Querying using class in Spring

i’m trying to do this query List<Product> findProductByCategory_CategoryNameAndPriceBetween(String category, double min, double max); but the return of the query is an empty list. What am I doing wrong? I also tried without the underscore between Category and Category Name. This are the class category and product: And this is how I have implemented the repository: Answer With the implementation below,

JPA Converter with contains query

I’m having some trouble with a particular query in my Spring Boot application. I’m using Spring’s built-in text encryption in order to encrypt text in my database I have an entity called BookRecord And a title encryption converter which looks like this I’m trying to search the database using a “contains” on the title, however because the title is encrypted

JPA Hibernate Annotation Issue

I have three Entities i’m modeling and am having issues with the associated annotations. I basically have a class that I intend on returning to the caller, a nested listed of Project’s and the Project can contain a nested list of Endpoint’s. It’s a top-level has-a one-to-many, then the nested one-to-many has two one-to-many’s. I’ve played with @JoinColumn annotations, i’ve

Spring Boot Jpa specification Set Enums IN Set Enums

Hi I want filter restaurant by type using Specification, but I get error: Parameter value [SUSHI] did not match expected type [java.util.Set (n/a)] How Can I comare List enums to list enums ? :/ My specification file: Restaurant model: Restaurant category: Answer Had the same problem and this question helped me. In my case, I wanted to search my commissions

Querying with ManyToOne association results in SQLException

I am trying out a simple use case for many-to-one association with Spring Data JPA but it is resulting in an SQLException. Model is of typical Order and OrderItem classes. Order OrderItem Unit test Unit test passes. But if I uncomment the line to find all items from OrderItemRepository it fails with following exception: What could be missing here ?

Create and use database function with JPA

I want to create and immediatly use a database function in a single sql call. As an example, the following works fine in PostgreSQL SQL Editor : But when i try to use it with JPA : I get the following error : How could i make this work ? Answer You’re trying to execute two queries at once. You

Advertisement