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

Tomcat won't deploy war because of error nested exception is java.lang.NoSuchMethodError: javax/persistence/SynchronizationType;

I am trying to deploy a spring boot application (bundled as war) in tomcat. While starting up the tomcat, it throws error Post-processing of merged bean definition failed; nested exception is java.lang.NoSuchMethodError:…
aman
  • 133
  • 3
  • 11
0
votes
1 answer

Is there any replacement for ROWNUM in Oracle?

I have JPA Native queries to an Oracle database. The only way I know to limit results is using 'rownum' in Oracle, but for some reason, query parser of a jar driver I have to use does not recognize it. Caused by: java.sql.SQLException: An exception…
Luís Palma
  • 249
  • 1
  • 7
  • 15
0
votes
1 answer

Lazy Loading with EJB + JPA + Jersey

I have the following working without FetchType.LAZY: @Entity public class Test { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; private String text; @ManyToOne @JoinColumn(name = "lazy_id") …
Eduardo
  • 277
  • 1
  • 6
  • 17
0
votes
1 answer

JPA update parent insert child

Am new to JPA, I have one parent and child table, when ever there insert, update I need to log that activity in child table. So when there is insert or update on parent I need to insert record in child. For example if there is update in parent then …
user1912935
  • 361
  • 4
  • 13
  • 34
0
votes
1 answer

Table with two related secondary tables

I am trying to may an entity with two associated tables, but I am not sure about this mapping aspect. Suppose that I have Entity P and its information is mapped to a table P and to another two tables (S1 and S2). public class P{ atributeType…
0
votes
0 answers

JPA - bind entites via primary key - Invalid identifier ORA error

I have the following two tables in my database: CREATE TABLE ACCOUNT ( ID NUMBER(19, 0) NOT NULL, AA_ID VARCHAR2(11 CHAR), BB_ID VARCHAR2(8 CHAR), STATUS NUMBER(1, 0) DEFAULT 1, CREATED_AT TIMESTAMP(6) NOT NULL, …
dorcsi
  • 295
  • 2
  • 6
  • 24
0
votes
0 answers

Spring Boot 2 JPA Exception translation With or Without Web/Rest

I am trying creating a JPA repo as follows, and facing few problems I want to translate all spring Exceptions to Business Exceptions as Service Layer (Not Web/Rest Service) All the examples and solution i come across on stackoevrflow and spring…
Zafar Ali
  • 37
  • 1
  • 8
0
votes
1 answer

Dynamic native query with one or many columns and result mapping (Object vs Object[])

I have some very basic SQLs where mainly the column(s) and the table are exchanged, e.g. as simple as: Select :COLUMNS from :TABLE The SQLs can have 1 or many columns and there is always 1 table. I used JPA just because we are on a Java EE 7…
Roland
  • 22,259
  • 4
  • 57
  • 84
0
votes
1 answer

No current bean manager found in CDI service in websphere 9

I am migrating from WAS 8 to WAS 9. my application uses Hibernate 4.3.0.Beta3 version and spring 4.0.3. At the time of application start up I am getting this error: An error occurred in the org.hibernate.jpa.HibernatePersistenceProvider…
praful
  • 1
  • 2
0
votes
2 answers

What is the significance of being the realtionship owner and how does CASCADE work with the two sides in JPA?

I have two tables. Transactions and Errors. There exists a One-To-Many relationship between Transactions and Errors. This is a bi-directional relationship and Errors is the owning side as @JoinColumn is specified in the Errors class. I want to…
worldbeater
  • 321
  • 1
  • 4
  • 10
0
votes
1 answer

How to map one simple class(not an entity) with dto(Entity) class using jpa

I tried @OneToOne Mapping with non @Entity class but it seems i am doing something wrong please help. Here is error log for the following classes. Caused by: org.hibernate.AnnotationException: @OneToOne or @ManyToOne on…
VIKAS ROY
  • 80
  • 1
  • 13
0
votes
0 answers

JPA error in merge: Password expired error if insert only

We are using entitymanager merge method to either update (if existing) or insert (if not existing) records in a certain table. What happens is if it is an update, there are no errors, but if it is insert, we see the following error from our…
0
votes
1 answer

How do I get a Month from LocalDate in JPQL query?

I got a transaction with a LocalDate as created attribute: private LocalDate created; I also got following query to retrieve every date out of my table transaction. SELECT DISTINCT t.created FROM Transaction t This however just gives me all dates…
alexander
  • 1,191
  • 2
  • 20
  • 40
0
votes
0 answers

Applying JPA specification on child entities while loading parent entity

I have a parent entity which has oneToMany relationship with childEntity. Using Parent Specification I am able to filter parent records based on attributes of childEntity But while loading parentEntity It loads all child entities without any…
yagyavrat
  • 107
  • 2
  • 11
0
votes
1 answer

How to insert and update 3 table by Creating a Composite-ID class for the composite key using JPA annotation

There are three tables HouseEntity, HousePersonEntity and PersonEntity. HouseEntity is identified with unique combination of houseNumber and houseName. This entity has no primary key it has houseNumber and houseName as composit key. PersonEntity has…
ami
  • 35
  • 7