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

HQL generate TOP() clause to Postgres database

I have a software "jsf + spring + jpa" compatible with oracle, sqlserver, and postgres. However, currently there arose a problem when paging. The query generated for the Postgres database creates a TOP() clause that is not compatible with Postgress.…
diegohsi
  • 136
  • 1
  • 2
  • 10
0
votes
0 answers

Handling table with multiple child entities with Discriminators

I have a user table with different types of users. The type of the user is determined by user_type column in user table. I have a company table which has one to many relationship with User. I have different classes for different users like Guest,…
Adithya Puram
  • 303
  • 2
  • 6
  • 23
0
votes
1 answer

persistenceUnitName with JPA2.1

I am having a Spring project (with JPA2.1) and persistenceUnitName is defined as "default" in that project. I have defined the dependency (using maven) of this project (using spring-core.jar in another project to reuse some Entity classes and other…
0
votes
2 answers

How to Inject @Alternative with CDI from WAR into JAR Module

The TheConverter would like to use an injected Config produced by the ConfigProducer. Where ConfigProducer is in the WAR but TheConverter and Config are in a jar. Sadly it seems the config isn't injected leading to a javax.ejb.EJBException:…
Kristof Neirynck
  • 3,934
  • 1
  • 33
  • 47
0
votes
2 answers

How to prevent hibernate 4 caches for NamedStoredProcedureQueries?

I'm implementing a web app based on spring 3.2.8, jpa2.1 and hibernate 4.3.5. I'd like to know how I can prevent hibernate caching a specific Named Stored Procedure Query. I'd tried entityManager.clear(), but I think it clears all cached entity…
Babak Behzadi
  • 1,236
  • 2
  • 16
  • 33
0
votes
2 answers

Count the number of rows filtered by using "group by" and "having" in JPA

I have two tables in MySQL database. product order_item Customers place orders of products which are stored into the order_item table - a one-to-many relationship from product to order_item. Currently, I'm executing the following query. SELECT…
Tiny
  • 27,221
  • 105
  • 339
  • 599
0
votes
1 answer

How to convert SQL Query using CriteriaQuery in JPA

I want to convert my sql query from SQL to Criterias (i dont want to use JPQL), i have this sql query: SELECT * FROM ( SELECT CONCAT_WS(' ',p.first_name, p.middle_name, p.last_name) AS fullname FROM persons p) AS tmp WHERE fullname LIKE '%cetina…
maxtorzito
  • 308
  • 7
  • 14
0
votes
0 answers

JPA transaction and rollback

hy all; if i have 4 table A,B and C, D where: A and B has a relationship between them. table C not has relation with A and B and D, table D not has relation with A, B and C i have 4 interface local for ongly table i have 4 class implement…
sghaier ali
  • 433
  • 2
  • 15
0
votes
1 answer

Glassfish 4 - TransactionRequiredException using Hibernate and CDI @Transactional

I am getting the following exception: javax.el.ELException: javax.persistence.TransactionRequiredException at com.sun.el.parser.AstValue.invoke(AstValue.java:279) at com.sun.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:304) at…
tak3shi
  • 2,305
  • 1
  • 20
  • 33
0
votes
1 answer

HSQLDB + EclipseLink + generate DDL + DATE JODA TIME = wrong TIMESTAMP

I'm using: Eclipselink 2.5.0 HSQLDB 2.3 JPA 2.1 Spring 4.0.5 I have this entity: @Entity public class MyEntity { ... @Temporal(TemporalType.DATE) @Convert(converter = MyLocalDateTimeConverter.class) private LocalDate…
Beto Neto
  • 3,962
  • 7
  • 47
  • 81
0
votes
1 answer

"Needs to be compiled" badge on static metamodel classes in JPA 2.1

Given the following environment to run an enterprise application in Java EE 7. GlassFish Server 4.0 NetBeans IDE 8.0 JDK 1.7 EclipseLink 2.5.1 having JPA 2.1 EclipseLink Metamodel Generator provided by EclipseLink itself -…
Tiny
  • 27,221
  • 105
  • 339
  • 599
0
votes
1 answer

JPA Repository not working properly

I am new to Open JPA and I am migrating my application DB services from JPA with Hibernate as vendor provider to JPA with OpenJPA as vendor Provider. Everything is fine, but I am not able to migrate my repositories. I am getting below error: Caused…
Atul Kumar
  • 75
  • 1
  • 13
0
votes
1 answer

Using List or Set in JPA 2.1 for multiple columns in same table

I am new with JPA. I am building sample maven project with Wicket-Spring-Hibernate-JPA. I am using Hibernate EntityManager: v4.3.5.Final. I am using JPA: v2.1-api. I am using database mySql: v5.6. When I am writing a model class, I want to map…
Mandar Pandit
  • 2,171
  • 5
  • 36
  • 58
0
votes
1 answer

JPA 2.1 Eager Fetch Attribute

I have an attribute (creationTimestamp in MetaData) which I annotated to load lazy. No I need it for one entity to load eager. I tried it with fetch graphs without success. Is there a JOIN FETCH like feature I can use to FETCH it in the query? I am…
mkuff
  • 1,620
  • 6
  • 27
  • 39
0
votes
1 answer

How would you make a JPA 2.1 module independent of the JPA implementation?

I have some JPA module which includes entities using @Index and some code using EntityManagerFactory etc. that is currently depending directly on OpenJPA. What is a good way to make it independent of the JPA implementation without limiting it to…
user1050755
  • 11,218
  • 4
  • 45
  • 56
1 2 3
43
44