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 2.1 - Not able to call Oracle function

I am not able to call a Oracle function through JPA 2.1. However the same function works fine with JDBC CallableStatement. I have the below definition in my Entity class. @NamedNativeQuery(name = "getAllAirlinesNQ", query = "{? = call…
Jay
  • 9,189
  • 12
  • 56
  • 96
0
votes
1 answer

Optimistic Locking on Collections without version column in Database

Lets say there is a persistable class with some properties and one collection(oneToMany mapping). Lets assume initially there is only one record with an id and with no collection saved in it initially. Lets say that there's a Thread T1 which loads…
Abhijeet
  • 689
  • 2
  • 10
  • 19
0
votes
1 answer

SQL0913 Row or object table in Schema type *FILE in use

I am having a transaction using spring data , and I am trying to do an save operation (insert operation) . [SQL0913] Row or object table in Schema type *FILE in use. Following is the…
user4920073
0
votes
1 answer

EclipseLink Sequence generator does not start from initial value provided

PFB my code, @GeneratedValue(strategy=GenerationType.SEQUENCE,generator="empIdSequence") @SequenceGenerator(name="empIdSequence",initialValue=10000,allocationSize=1) private Integer empId; I am using EclipseLink 2.5.x implementation and…
JPS
  • 2,730
  • 5
  • 32
  • 54
0
votes
0 answers

Why is EntityManager Transaction rollback() not working even if a PersistenceException is provoked intentionally?

PFB my code, try { entityManager = emFactory.createEntityManager(); emTransaction = entityManager.getTransaction(); emTransaction.begin(); EmployeeEntity e1 = new EmployeeEntity(); …
JPS
  • 2,730
  • 5
  • 32
  • 54
0
votes
1 answer

JPA 2.1 Schema gereration problems

I'm trying to use pure JPA 2.1 as a standardized way to generate db schema. (Underlying database - Derby embedded, persistence provider - eclipseLink) To check generated scripts I set
Alex Silkovsky
  • 541
  • 5
  • 18
0
votes
1 answer

Is it possible to configure JBoss EAP 6.4.x for Spring 4 and Hibernate 4.3.10 using JPA 2.1 by configuring it over jboss-deployment-structure.xml?

We recently switched to Java 8 to use java.time API (LocalDate, LocalDateTime,...). Therefore we updated our Hibernate dependency to version 4.3.10. We wrote some AttributeConverters to help Hibernate to map new Java 8 classes to the…
0
votes
1 answer

jpa lazy return all element

I have two class Brand and Model. I use lazy loading. @Entity public class Brand { @Id @GeneratedValue(strategy = GenerationType.AUTO) private long brandId; private String brand; @OneToMany(cascade = CascadeType.ALL, fetch =…
robert trudel
  • 5,283
  • 17
  • 72
  • 124
0
votes
1 answer

Cascade types in JPA

Given two entities Department and Employee forming a one-to-many relationship from Department to Employee. Since the relationship is quite intuitive, I am leaving out the entity classes. In Department : @OneToMany(mappedBy = "department", fetch =…
Tiny
  • 27,221
  • 105
  • 339
  • 599
0
votes
1 answer

I'm not able to find Hibernate 2.* option in JPA Facet plataform

Hi, I'm trying to configure JPA 2.1 through "Project Facets". Why can't I see "Hibernate 2.x" in plataform JPA Facet selection menu after selecting JPA 2.1 and going through further configuration? I have Eclipse Luna and also JBoss Tools. Maven: …
Solano
  • 550
  • 2
  • 9
0
votes
0 answers

Glassfish 4.1, JPA 2.1 persistance.xml

i faced with error like this : Caused by: javax.xml.bind.UnmarshalException: unexpected element (uri:"http://xmlns.jcp.org/xml/ns/persistence", local:"persistence"). Expected elements are <{http://java.sun.com/xml/ns/persistence}persistence> …
Benjamin
  • 531
  • 2
  • 6
  • 18
0
votes
1 answer

Calling a Oracle Function from JPA 2.1?

Im trying to call an oracle function from JPA 2.1 and am getting this error - org.hibernate.exception.GenericJDBCException: could not extract ResultSet ... Caused by: java.sql.SQLException: Missing IN or OUT parameter at index:: 6 at…
farrellmr
  • 1,815
  • 2
  • 15
  • 26
0
votes
1 answer

order by when using Constructor Expressions in JPA 2

As a part of JSR-338 came the feature of using Constructor Expressions. The question is how I can use order by when using Constructor Expressions. Given the example JPQL: select com.acme.AggregatedInfo( c, (select status from Account where…
stalet
  • 1,345
  • 16
  • 24
0
votes
1 answer

Can I add non-Id fields in join table in Many to Many Relationship?

I have many to many relationship between Person and Address tables. Person: @Entity @Table(name = "PERSON_MTM", schema = "Examples") public class Person { @Id @Column(name = "PERSON_ID") private String personId; @Column(name =…
Dev
  • 13,492
  • 19
  • 81
  • 174
0
votes
0 answers

Converting SQL statement to JPQL statement and use it

I want to make report for top 10 most table ordered in time range : but i can not I have 2 entity class : DiningDable.java (SELECT d FROM Diningtable d). Ordertabledetail.java (SELECT o FROM Ordertabledetail o). In entity class 1 have…