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 OneToMany bidirectional relation [EclipseLink-63] error

Please can you help me? In JPA, I try to create a OneToMany bidirectional relation, but I have the following errors : "[EclipseLink-63] : The instance creation method [entity.OrderLine.], with no parameters, does not exist, or is not…
0
votes
2 answers

JPA 2.1: received org.hibernate.exception.ConstraintViolationException using orphanRemoval

I have 3 enties which have following mapping and I want to use orphanRemoval when I want to delete parent entities: @Entity @Table(name = "EvaluationRequest", schema = "dbo") public class EvaluationRequestDMO implements java.io.Serializable…
Hutsul
  • 1,535
  • 4
  • 31
  • 51
0
votes
1 answer

Invocation of init method failed; nested exception is java.lang.NoSuchMethodError: javax.persistence.Table.indexes()[Ljavax/persistence/Index

I am trying to upgrade from Tomcat 7.0.63 to 8.5 and running into this NoSuchMethodError exception. I have hibernate 4.3.8, hibernate-jpa-2.1-api-1.0.0.Final.jar, and spring mvc 4.1.4. the exception trace is as…
Jason
  • 21
  • 1
  • 3
0
votes
0 answers

Getting an EntityManagerFactory whitout persistence.xml

I develop a webApp which is connecting to many similar database. The target databases are set by the final user in an administration GUI. They work with differents database engine. I use JPA and Eclipselink 2.6.4 to query theses databases. Actually…
sleray
  • 11
  • 4
0
votes
1 answer

SQLResultSetMapping is throwing exception in case of null columns

I've got a value object for which i want to map my native query resultset. I'm using @SQLResultSetMapping to map object fields but when value of any column is null, exception is throw: Exception [EclipseLink-6177] (Eclipse Persistence Services -…
grizzly
  • 588
  • 4
  • 12
0
votes
1 answer

JPA tries to insert the same entity twice in the database when using EJBs with PersistenceContext in EntityListener

I want to achieve an auditing for some of my JPA entity classes via composition and some JPA callback methods. My current approach (shortened) looks like this: Every entity which I want to audit implements the following simple interface: public…
stg
  • 2,757
  • 2
  • 28
  • 55
0
votes
0 answers

JPA 2.1 : Custom JPQL in CriteriaBuilder

I'm migrating some code that uses DetachedCriteria of Hibernate to a new one using standard CriteriaBuilder of JPA 2.1. I have the following code : criteria.add(Restrictions.sqlRestriction("sin(?) * sin(x) + cos(?) * cos(y) * cos(x- ?) <= ?",…
Radouane ROUFID
  • 10,595
  • 9
  • 42
  • 80
0
votes
1 answer

Result set whit duplicate rows in jpa (Hibernate)

I have the next sql query: SELECT @row_number:=@row_number+1 AS ID, IGN_DATES.PLACA, IGN_DATES.FECHA, OFF_DATES.FECHA FROM (SELECT a.PLACA AS PLACA, MIN(p.FECHA_GPS) AS FECHA FROM POSICIONHISTORIAL p JOIN AUTOMOVIL…
Gaalvarez
  • 165
  • 1
  • 7
0
votes
1 answer

Error saving object because a null

I'm getting an error at saving ValoracioItem because is idEscalaPregunta is null. In LOG I can see that it is trying to add two inserts the first one in t_valoracioitem that is correct, but the second one in a_escalaresposta that it is already in…
Joe
  • 7,749
  • 19
  • 60
  • 110
0
votes
1 answer

Table with composite primary key and version field in JPA

I tried using @IdClass for this and regular @Version annotation on the version field but i keep getting the Error: OptimisticLockException: Attempted to attach deleted instance type "class xxx" with oid "xxx". If the instance is new, the version…
Yan.F
  • 630
  • 5
  • 20
0
votes
1 answer

Is Hibernate -OGM does not supports InheritanceType.JOINED?

Hi i am migrating my application mysql database to mongodb using hibernate-ogm. In my pojo i used InheritanceType.JOINED ,but i read in documentation "Hibernate OGM supports the following inheritance strategies: * InheritanceType.TABLE_PER_CLASS *…
0
votes
3 answers

javax.persistence.Query does not set parameter

Here is the Query instance I'm executing entityManager.createNativeQuery(SHIPMENTS_UNION_QUERY, RESULT_MAPPER) .setParameter("aggreagateCategories", aggregatePCNames) .setParameter("startDate", startDate) …
Somasundaram Sekar
  • 5,244
  • 6
  • 43
  • 85
0
votes
1 answer

How to run app Hibernate 5.x, Jpa 2.1, Java EE7(javaee-api 7.0) on Tomcat7 with Jax-RS(Jersey)

I have a simple application runs succesfully as a Java Application. The frameworks used in app Hibernate 5.x, Jpa 2.1, Java EE7(javaee-api 7.0). And then i wanted to add Jax-Rs support which i want to run it on Tomcat 7. I got some errors when i…
Ahmet
  • 314
  • 5
  • 15
0
votes
0 answers

JPA join query with not in condition

I'm having three tables Client, Task and TaskClient. TaskClient is having client as foreign key. Below is the bean: @Entity @Table(name="TaskClient") public class TaskClient implements Serializable { @Id @GeneratedValue(strategy =…
Krishna
  • 1,865
  • 4
  • 18
  • 26
0
votes
1 answer

Bidirectional @ManyToMany doesn't remove records from the join table xx_yy with CascadeType.ALL

I'm implementing categorisation system where a category will usually have several subcategories, and a subcategory will have at least one parent, but there will certainly be cases when a subcategory will have more than one parent. That's why I chose…
developer10
  • 1,450
  • 2
  • 15
  • 31