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 uni-directional OneToMany mapping : EDITED

If have a JEE6 application that works fine on Glassfish 3.1.1 since years. Now have to move it to JEE7 / Glassfish 4.1.1 and ran into a couple of problems regarding JPA / Eclipselink: a) I have an entity Applicant that contains a couple of Lists…
0
votes
0 answers

How to set the columnDefinition globally with JPA/EclipseLink?

All attributes within my persistence unit which have the type "MyCar" should be mapped to the same database column type "VARCHAR(255)". At the moment I have to set the @Column annotation to each and every attribute as…
Chilly Code
  • 678
  • 2
  • 6
  • 17
0
votes
1 answer

How do I write a JPA criteria query to find an object in a date range and include the endpoints of that date range?

I’m using JPA 2.1 with Hibenrate 5.1.0.Final. How do I write a JPA CriteriaBuilder query in which I’m querying for objects in a date range and I want to include the endpoints of the date range in my query? I’m noticing that the following…
Dave
  • 15,639
  • 133
  • 442
  • 830
0
votes
0 answers

JPA entity with join possibly on null key

I'm building an application based on JavaEE7 with JPA 2.1 and EJB 3.2. I'm trying to define entity with JPA based on the table from an Oracle database. I use EclipseLink as implementation of JPA. My case is to retrieve translation stored on the…
MaximeL
  • 63
  • 1
  • 7
0
votes
1 answer

Weblogic + Hibernate Error: javax.persistence.JoinTable.indexes()[Ljavax/persistence/Index

I'm migrating a project that was running on Tomcat 8 to Weblogic. I am using Hibernate + JPA 2. When I deploy in weblogic got the following error: Failure occurred in the execution of deployment request with ID "26012160125422" for task "114". Error…
Thiago
  • 3
  • 4
0
votes
1 answer

JPQL how to define BigInteger constants

In a JPQL query I compare a numeric constant to a bind parameter of type BigInteger (:param = 1). Is there any way to define that the constant type is a BigInteger in order to avoid IllegalArgumentException.
Ilias Stavrakis
  • 753
  • 10
  • 19
0
votes
1 answer

JPA configuration - persistence.xml is automatically created under src/main/java instead of src/main/resource

I am using Maven 3.3.9 and created a Maven Web Project in Spring tool suite and using Eclipse. Recently I went through a Tutorial for configuring JPA with maven project. Tutorial showing JPA configuration I successfully configured Database…
Naresh Raj
  • 297
  • 1
  • 6
  • 18
0
votes
1 answer

Glassfish - cannot remove entity using JPA

In my exploration of JPA, I have the code below (which I understand should not be used in production). Running my code produces the following error: java.lang.IllegalStateException: Exception Description: Cannot use an EntityTransaction while using…
KG6ZVP
  • 3,610
  • 4
  • 26
  • 45
0
votes
1 answer

how to make database configuration configurable of persistance.xml file through database.properties file

I would like to get confirmation on the query "Is there any way to make database configurations configuration through database.properties using in persistance.xml". Is the below possible? My following configuration works absolutely fine,
user4821194
0
votes
0 answers

Count on limited related entity in JPQL

I'm new to JPA and JPQL, so forgive me is this is simple an I'm simply missing something small. Assume that I have the following (T-SQL): CREATE TABLE tblCustomer (id int IDENTITY(1,1) NOT NULL, CustName nvarchar(50) NOT NULL, CONSTRAINT…
0
votes
3 answers

Auto generate data schema from JPA 2.1 annotated entity classes without a database connection

Two years ago I was working on a project using: spring 4.0.3.RELEASE jpa 2.0 hibernate 4.2.7.Final java 1.6.X This project has a maven task hibernate3-maven-plugin which allow us to generate a database schema without any connection to a database…
0
votes
1 answer

JPA - apply @Column(columnDefinition = "Boolean") to all Basic Attributes of type Boolean

is it possible to set the DDL type Boolean to all @Basic attributes of type java.lang.Boolean? I'm using Hibernate, which by default creates an sql bit as DDL type. Update I currently solved it Hibernate specific by using a custom…
Stefan K.
  • 7,701
  • 6
  • 52
  • 64
0
votes
1 answer

Hibernate does not work with enums with @Id and @Convert or @Converter(autoApply=true)

with some public class SomeDao { @Id private MyEnum id; public MyEnum getId() { return id; } } @Converter( autoApply=true ) public MyEnumConv { ... } you will get something similar to (JPA 2.1/Hibernate…
Andreas Covidiot
  • 4,286
  • 5
  • 51
  • 96
0
votes
1 answer

JPA: How do I prevent a field from being written back into the database?

I’m using Hibernate 4.3.6.Final, JPA 2.1, MySQL 5.5.37, and Spring 3.2.11.RELEASE. I have an entity with the following field and getter (no setter) … @Column(name="CREATED_ON") private java.util.Date createdOn = new java.util.Date(); public…
Dave
  • 15,639
  • 133
  • 442
  • 830
0
votes
1 answer

Weblogic 12c and Spring-Data-JPA Deployment JPA 2.1 Conflict

I'm trying to deploy a spring-data-jpa,apache-cxf integrated project to Oracle Weblogic 12c (12.1.3) with below dependencies and getting below exception. jdk :1.7 weblogic :…
sabri
  • 15
  • 2
  • 6