Top "Jpa" questions

The Java Persistence API (JPA) is a Java specification for accessing, persisting, and managing data between Java objects/classes and a relational database.

JPA & Criteria API - Select only specific columns

I would like to select only specific columns (ex. SELECT a FROM b). I have a generic DAO and what …

java hibernate jpa criteria-api
Hibernate vs JPA vs JDO - pros and cons of each?

I'm familiar with ORM as a concept, and I've even used nHibernate several years ago for a .NET project; however, …

java hibernate orm jpa jdo
JPA Hibernate One-to-One relationship

I have a one-to-one relationship but hibernatetool complains when generating the schema. Here's an example that shows the problem: @Entity …

java hibernate jpa
Configure hibernate (using JPA) to store Y/N for type Boolean instead of 0/1

Can I setup JPA/hibernate to persist Boolean types as Y/N? In the database (the column is defined as …

java hibernate jpa
Spring JPA @Query with LIKE

I'm trying to make a method in CrudRepository that will be able to give me list of users, whose usernames …

java jquery sql spring jpa
Create JPA EntityManager without persistence.xml configuration file

Is there a way to initialize the EntityManager without a persistence unit defined? Can you give all the required properties …

jpa runtime entitymanager persistence.xml
How to manually force a commit in a @Transactional method?

I'm using Spring / Spring-data-JPA and find myself needing to manually force a commit in a unit test. My use case …

java spring jpa spring-data spring-transactions
How to properly express JPQL "join fetch" with "where" clause as JPA 2 CriteriaQuery?

Consider the following JPQL query: SELECT foo FROM Foo foo INNER JOIN FETCH foo.bar bar WHERE bar.baz = :baz …

java jpa criteria jpa-2.0
Specifying an Index (Non-Unique Key) Using JPA

How do you define a field, eg email as having an index using JPA annotations. We need a non-unique key …

java hibernate orm jpa datanucleus
Spring Data JPA find by embedded object property

I want to write a Spring Data JPA repository interface method signature that will let me find entities with a …

java spring jpa spring-data spring-data-jpa