Skip to content
Advertisement

How to use Criteria in JPA in Spring boot?

I am using JPA and spring boot. I am new to JPA. I want to retrieve an object by passing the value of the function. But in example, it is done through hibernate config. I have not config sessionFactory bean in my classpath. I want to use JPA to retrieve the object. Here in the example, it is:

JavaScript

But I tried in JPA like this:

JavaScript

But it is showing me error,How can i pass the username using JPA?

my pom.xml is:

JavaScript

I also tried as follows:

JavaScript

But how to set username here?

Advertisement

Answer

You can use JPQL like this

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