Questions tagged [jpa-2.1]

This tag is for questions specifically about new features of version 2.1 of the Java Persistence API.

The Java Persistence API version 2.1 improves JPA 2.0 with features like bulk operations, stored procedure support and new JPQL keywords.

Main features included in JPA 2.1 is:

  • Converters - allowing custom code conversions between database and object types.
  • Criteria Update/Delete - allows bulk updates and deletes through the Criteria API.
  • Stored Procedures - allows queries to be defined for database stored procedures.
  • Schema Generation
  • Entity Graphs - allow partial or specified fetching or merging of objects.
  • JPQL/Criteria enhancements - arithmetic sub-queries, generic database functions, join ON clause, TREAT option.
659 questions
0
votes
1 answer

JPA basic type ElementCollection computed value in query

Consider the following Entity : @Entity public class Parent{ @Column private String name; @ElementCollection @CollectionTable(name="REF_TABLE",joinColumns=@JoinColumn(name="REF_COLUMN_ID")) @Column(name="REF_COLUMN_VALUE") public Set
Alexander.Furer
  • 1,817
  • 1
  • 16
  • 24
0
votes
1 answer

JPA query for filtering based on property of entity list

I have a Spring MVC app using Postgre 9.3 and JPA2.1 (Hibernate implementation). I have a Class 'Movie' which has Set of Reviews within it. I want to write a JPA NamedQuery which returns me all the details of Movie but only Approved reviews. Reviews…
AAgg
  • 494
  • 1
  • 3
  • 19
0
votes
2 answers

Set timeout on a TypedQuery with JPA2

I would like to set a timeout on a javax.persistence.TypedQuery. I've found this easy method : TypedQuery query = ... ; query.setHint("javax.persistence.query.timeout", 1000); query.getReturnList(); But it seems that does not work, it's just…
Gaetano Piazzolla
  • 1,388
  • 1
  • 16
  • 31
0
votes
0 answers

Spring boot data JPA getting NullPointerException related to transaction manager

At the outset, I have tried the options mentioned in various forums for the same stack trace I get. A few of them did not work while with others (like removing javax.persistence.transactiontype) I did not understand how and where to try it. I am…
Paddy
  • 3,472
  • 5
  • 29
  • 48
0
votes
2 answers

use criteria API to select * from where ... clause

I have two entities: Session and Formation. They have a common attribute idFormation. I want to select all sessions which have the same id as the formation using criteria API (the idFormation is the argument of my method) but at least I have an…
Betty
  • 67
  • 1
  • 8
0
votes
1 answer

EclipseLink: how to obtain instance of Project class so I can call setDefaultQueryResultsCachePolicy

In EclipseLink 2.5.2, how can I obtain the instance of the org.eclipse.persistence.sessions.Project class that is associated with my existing PersistenceUnit / EntityManagerFactory so that I can call setDefaultQueryResultsCachePolicy? Thanks.
XDR
  • 4,070
  • 3
  • 30
  • 54
0
votes
0 answers

Ways to return a list of tuple rows through JPA while using PrimeFaces LazyDataModel

There may be situations where we need to return a list of tuple rows from the associated data model i.e not a fully qualified entity but a part of it, specifically a list of selected columns from the associated data-source (may be a database). I…
Tiny
  • 27,221
  • 105
  • 339
  • 599
0
votes
2 answers

Compare Long to String

In JPQL in a where condition I want to do: book.id like lower(:search) The problem: book.id is a Long but the :search parameter is a String. Will the above just work the way it is or do I need to explicitly convert book.id to String and if that's…
Roland
  • 7,525
  • 13
  • 61
  • 124
0
votes
0 answers

EclipseLink Remove Cascade

I have been developing a web application running on the Glassfish Server. I use JPA with EclipseLink implementation. These are my two entity classes. I represent the relation between them below. When I start the Glassfish server and delete the…
Softengilker
  • 173
  • 1
  • 3
  • 11
0
votes
2 answers

Hibernate 4.3.6 + Glassfish 4.1 + JPA 2.1

I'm trying to migrate from EclipseLink to Hibernate in my Java EE 7 application and running into some issues I'm not able to figure out. Here my environment: Glassfish 4.1 Hibernate 4.3.6 Java 1.8.0_20 I'm also using: EE 7 CDI JPA 2.1 Ultimately…
Jim
  • 668
  • 8
  • 22
0
votes
1 answer

JPA 2.1 not loaded in Resin 3.1.9

I am using Resin 3.1.9 to run Java Web Application with JPA 2.1. I have put libraries (JAR) on my WEB-INF/lib folder, and I have include them to resin.conf by this:
danisupr4
  • 815
  • 1
  • 9
  • 22
0
votes
1 answer

How to use EJB-CMT with Spring and JSF in STS?

Is it possible? I want to use it like described here: @PersistenceContext private EntityManager em; ... em.persist( entity1 ); em.merge( entity2 ); em.find( MyEntity.class, id ); (Still working on this project) I successfully tried to get…
richard
  • 59
  • 2
  • 14
0
votes
1 answer

could not get a field value by reflection hibernate JPA + GF 4

I am using JPA 2.1 with Hibernate 4.3.x on Glassfish 4, also tried the suggestion listed at https://coderwall.com/p/e5fxrw still get the below error. Could some one let me know what might be the issue ? javax.persistence.PersistenceException:…
Ayub
  • 599
  • 3
  • 10
  • 24
0
votes
1 answer

JPA tree value propagation on persist/merge

I have @Entity public class Node { @ManyToOne private Node parent; @OneToMany(mappedBy = "parent", cascade = CascadeType.ALL, orphanRemoval = true) private List children; @ManyToMany private List ownerList; …
Michele Mariotti
  • 7,372
  • 5
  • 41
  • 73
0
votes
1 answer

EclipseLink NullPointerException from CriteriaBuilder

I'm using PrimeFaces datatable to load data from my database with LazyDataModel. This has been working perfectly. But recently i encountered a strange problem when i altered the code a little bit. And i assume this has nothing to do with…
amofasser
  • 59
  • 1
  • 7