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
4 answers

JPA create, edit and delete entities from database

How should I manage the create, edit and delete operations with entites as simple as possible? For example: User: public class User { @Id @GeneratedValue(strategy = GenerationType.AUTO) private Integer id; private String name; …
BlackCat
  • 521
  • 3
  • 8
  • 22
0
votes
1 answer

JPA - Delete entities from @ManyToMany self

I have documents, that are referenced by other documents. I store this connection in the entity. @Entity public class Document extends AbstractEntity { @ManyToMany(cascade = {CascadeType.MERGE, CascadeType.PERSIST, CascadeType.REFRESH}) …
BlackCat
  • 521
  • 3
  • 8
  • 22
0
votes
1 answer

Existing entity cannot be updated with Spring Boot

My Spring Boot app has the following classes: Board (JPA entity) @Entity @Table(name = "board") public class Board { public static final int IN_PROGRESS = 1; public static final int AFK = 2; public static final int COMPLETED = 3; …
Hutsul
  • 1,535
  • 4
  • 31
  • 51
0
votes
1 answer

org.apache.openejb.server.cxf.rs.PojoInvoker throws invocationTargetException

I am using CDI, JPA 2.1, hibernate 4.3.5.Final with tomee. when I try to create a entityManagerFactory; it runs to org.apache.openejb.server.cxf.rs.PojoInvoker which has code in it as if (tcclToUse != null) { …
manu
  • 77
  • 1
  • 3
  • 14
0
votes
0 answers

Provider org.hibernate.envers.event.EnversIntegrator not a subtype error in CDI+JPA2.1+Restful

I am trying to call JPA from a rest web service. but it throws me org.hibernate.integrator.spi.Integrator: Provider org.hibernate.envers.event.EnversIntegrator not a subtype at…
manu
  • 77
  • 1
  • 3
  • 14
0
votes
1 answer

In JPA, having a @ManyToOne as @Id throws ClassCastException when doing em.getReference()

I have this simple code that results in the following exception, what could be the problem?? MenuPK menuPK = new MenuPK(aVenueId, aMenuId); Menu menu = em.getReference(Menu.class, menuPK); // where em is an EntityManager //Menu menu =…
DTs
  • 1,196
  • 1
  • 11
  • 28
0
votes
0 answers

JPA 2.1 Stored Procedure getOutputParameterValue() returns incorrect Data Type

I have this stored procedure: CREATE PROCEDURE `pct_getNextMenuId` (IN venueId INT UNSIGNED, OUT menuId TINYINT UNSIGNED) BEGIN UPDATE Venues SET lastSeqIdMenus = LAST_INSERT_ID(lastSeqIdMenus + 1) WHERE id=venueId LIMIT 1; SELECT…
DTs
  • 1,196
  • 1
  • 11
  • 28
0
votes
1 answer

Error with JPA persistence.xml No Persistence provider for EntityManager

I have pom.xml
Vy Do
  • 46,709
  • 59
  • 215
  • 313
0
votes
1 answer

NoClassDefFoundError in JPA 2.1

I am getting a java.lang.NoClassDefFoundError: org/hibernate/service/classloading/spi/ClassLoaderService Exception I am using maven 4, jpa 2.1, hsqldb. am i missing something in my pom. i can add it if needed. it fails in unit tests, maven etc. I…
manu
  • 77
  • 1
  • 3
  • 14
0
votes
1 answer

What is the life cycle of EntityManagerFactory in application managed application?

I am using JPA 2.1. Entity Managers are application managed here. Sample Class: public class TestDao { private static EntityManagerFactory emf; private static EntityManager em; public static EntityManager initialize() { if (emf == null) { …
Dev
  • 13,492
  • 19
  • 81
  • 174
0
votes
1 answer

HANA Cloud Data Source issue with Tomcat 7

I need to deploy the Spring based Java Application in the HANA Cloud, i am not able to get the Data source giving error 2016 05 17 14:33:45#INFO#LJS_OUTPUT#Thread-11#14:33:45.128 [localhost-startStop-1] ERROR…
chiranjeevigk
  • 1,636
  • 1
  • 23
  • 43
0
votes
0 answers

using JPA 2.1 with Glassfish 3.1 : java.lang.NoSuchMethodError: javax.persistence.EntityManager.createNamedStoredProcedureQuery

I am using Glassfish 3.1.2.2 (which uses JPA 2.0). I would like to call PL/SQL stored procedures in JPA 2.1. I have an Oracle database. How can I do that ? My pom.xml : org.eclipse.persistence
ballidanse
  • 157
  • 5
  • 13
0
votes
1 answer

CommandLine nashorn script (jjs) unable to create entity manager. Why?

CommandLine nashorn script (jjs) unable to create entity manager. Why does this not work? How can it be made to work (if at all)? i.e., running the script looks like this... $ jjs -cp ".;myjpaclasses-1.jar;" myNashornScript.js i.e., where…
sairn
  • 461
  • 3
  • 24
  • 58
0
votes
2 answers

How to use mappedBy with more than one value JPA

I have 2 tables: Currency and Rate The currency's primary key is referenced by the inputCurrency and outputCurrency foreigh keys in the Rate. How can I map these in order to cascadeALL? I tried in Rate (the table that contains the foreigh…
Nelly Junior
  • 556
  • 2
  • 10
  • 30
0
votes
1 answer

JPA 2.1, Eclipselink, SQL Server, Spring - NamedStoredProcedureQuery result mapping

Using javax or eclipse link @NamedStoredProcedureQuery, I would like to call a sql server stored procedure that does not have a cursor or and out parameter and return the result set without having to map the results manually. When I use springs…
blur0224
  • 972
  • 8
  • 26