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

JPA shared column on composite foreign key with null values

I am working with eclipseLink 2.6 and I have this entity: @Entity @Table(name="ESPACIOACADEMICO") @NamedQuery(name="EntityEspacioacademico.findAll", query="SELECT e FROM EntityEspacioacademico e") public class EntityEspacioacademico implements…
Cristian García
  • 125
  • 1
  • 1
  • 8
0
votes
1 answer

JavaFX and JPA2 don't compile

I'm trying to use JPA2 for the persistence of a classes and write the GUI with javaFX. But at the compile time I get this error (with EclipseLink library): An annotation processor threw an uncaught exception. Consult the following stack trace…
selan
  • 956
  • 3
  • 11
  • 27
0
votes
1 answer

JPA first level cache not clreared after completion of transaction

I am using JPA 2.1(with EclipseLink implementation), to get a record from Database. By default it first level cache is enabled, it caches the record in PersistenceContext. If I try to get same record I will get it from first level cache, so no query…
Jagadeesh
  • 862
  • 7
  • 23
0
votes
1 answer

JPA version confusion

I was asked by my client to use JPA 2.5, I have been searching in internet for JPA 2.5, according to lot of blogs and web sites there is no JPA 2.5, but JPA 2.1 is available. Now my question is 'Are JPA 2.1 and JPA 2.5 versions same?'. It's a small…
Jagadeesh
  • 862
  • 7
  • 23
0
votes
1 answer

Using JPA 2.1, how do I map a native query result to a @Transient field taht is a Set?

I’m using JPA 2.1, Hibernate 4.1.3.Final, and MySQL 5.5.37. How do I map a result set to a @Transient collection? In my entity, I have set up @Entity @Table(name = "category", uniqueConstraints = { @UniqueConstraint(columnNames = { "NAME",…
Dave
  • 15,639
  • 133
  • 442
  • 830
0
votes
1 answer

JPA Criteria construct with non-entity parameter

I want to create a list of complex DTO objects with data from several Entities and one non-Entity-parameter. Let's say my DTO class has constructor: public MyDto(String entityField, String someString) {...} and I would like to use the…
golinko
  • 327
  • 2
  • 3
  • 14
0
votes
2 answers

Sets idenified by SonarQube as not serializable

I have an Entity with a Set of AuditRecords: private Set auditRecords; AuditRecord implements Serializable. However the Sonar scan identifies this Set and other Sets in other Entities as Critical issues: Fields in a "Serializable"…
Timothy S
  • 13
  • 1
0
votes
2 answers

Disabling JPA second level cache is not working

I use Hibernate JPA for my web application and I use Apache Tomcat for my web server. My problem is, after updating my entity obj, I call the another function to get the entity list. In that entity list, I see the old object instead of the updated…
0
votes
1 answer

Circumvent that storing an @Embedded field holding null is instantiated when loaded?

If a Person without an Address is persisted and loaded later on, Person contains an Address with all fields set to null. This (modified) example was taken from coderanch, where a similar problem was reported. @Embeddable public class Address { …
Stefan K.
  • 7,701
  • 6
  • 52
  • 64
0
votes
1 answer

How to deal with "Value '0000-00-00' can not be represented as java.sql.Timestamp" error at application level?

I’m using Spring 3.2.11.RELEASE, Hibernate 4.3.6.Final, JPA 2.1, and MySQL 5.5.37. I have a DATETIME column in my InnoDB table that has a column that occasionally gets set to ‘0000-00-00 00:00:00’. Hibernate can’t deal with this and I’d like to…
Dave A
  • 2,780
  • 9
  • 41
  • 60
0
votes
1 answer

Spring JPA Hibernate and AttributeConverter

I have a small application (spring 4.0, jpa 2.1, hibernate 5.0.2) and had been using "old" java.util.Date* classes as well as java.sql.Date*. Now I wanted to use java.time instead and read that it would work with an AttributeConverter. Unfortunately…
user3411565
  • 125
  • 1
  • 9
0
votes
1 answer

named stored procedure query Collection parameter?

I'm using JPA-2.1 and want a stored procedure and with a Collection as a parameter. Is this possible?
Roland
  • 7,525
  • 13
  • 61
  • 124
0
votes
2 answers

JPA/Eclipselink No persistence provider EntityManager on target server only

I have a Vaadin 7.3.8 portlet running in Liferay 6.2 CE using JPA 2.1 with EclipseLink 2.5.2 developed with Maven. The portlet runs as expected without JPA errors on my local Mac OS X box with a Liferay 6.2 / Glassfish 3.2 bundle and MySQL 5.6 and…
lifer
  • 31
  • 2
0
votes
1 answer

How do I use JPA 2.1's CriteriaBuilder.function with MySQL's "GROUP_CONCAT"?

I’m using JPA 2.1, Hibernate 4.3.6.Final, and MySQL 5.5. I read JPA 2.1 supports invoking native DB functions, but I’m having trouble figuring out how to invoke MySQL's “GROUP_CONCAT.” I have the following code … final CriteriaBuilder builder =…
Dave A
  • 2,780
  • 9
  • 41
  • 60
0
votes
1 answer

JPA 2.1 Drop Script execution from persistence.xml with Arquillian & Shrinkwrap

I'm writing some Arquillian (with Shrinkwrap) tests, and im currently using the JPA 2.1 create and drop automation with scripts, via persistence.xml: // src/test/resources-wildfly-remote/test-persistence.xml // runs fine, configured as resource in…