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

Error in creating EntityManagerFactory - Error Exception in creating Entity

I am getting Error in compiling Entity ...I think the error is in persistence.xml file but unable to find out the problem .can any one please tell the error persistence.xml file
khan
  • 185
  • 1
  • 2
  • 8
0
votes
1 answer

How to deploy JavaEE 7 / JPA 2.1 Dynamic Web Application to IBM Liberty Profile WITHOUT web.xml

I have a Dynamic Web Application that access a DB2 v10 zOS Database. I wish to use Hibernate 5 as my JPA 2.1 Provider and access my EntityManager via CDI. I do not want to use the Spring Framework at all; I also do not wish to have a web.xml…
Hector
  • 4,016
  • 21
  • 112
  • 211
0
votes
1 answer

JPA 2.1 - @NamedStoredProcedureQuery - ParameterMode.IN - null value gives error

I am trying to call a stored procedure using JPA 2.1 @NamedStoredProcedureQuery. I have the below annotations in my Entity class. The problem is I am not able to pass null values if I declare the mode as ParameterMode.IN. And able to pass null value…
Jay
  • 9,189
  • 12
  • 56
  • 96
0
votes
1 answer

Upgrade weblogic to JPA 2.1

By default, weblogic is using JPA 2.0. Is there a way to enable JPA 2.1 for weblogic 12.1.3 other than add pre_classpath in startWebLogic.cmd or OPatch? Thanks
SpyClown
  • 199
  • 1
  • 1
  • 14
0
votes
2 answers

Hibernate automatically creates table/drops old one

Whenever I run this code, hibernate will drop the current tables/ create a new one and fill it again: public static void main(String[] args) { UserRepository userRepository = UserRepository.getInstance(); UserEntity user = new…
Mansueli
  • 6,223
  • 8
  • 33
  • 57
0
votes
1 answer

Select all users in a group beside currentUser

I'd like to select all the users beside the current user in a given group. The relationship between group and user is many-to-many. At the moment my query selects all users in a given group. SELECT g.users FROM Group g WHERE g.groupName…
Ced
  • 15,847
  • 14
  • 87
  • 146
0
votes
0 answers

JPA Entity autodetection using class loader

I'm currently working on a project with a plugin system using Java's ServiceLoader. The plugin manager creates an URL classloader with the URLs of the jar-files, which is used to load the plugins. When creating the EntityManagerFactory, I set the…
user2610529
  • 491
  • 3
  • 10
0
votes
1 answer

How to convert this sql query to JPA criteria

I would like to do a string search on all the columns in my table or view in my database. Below is my SQL query. SELECT * FROM MY_FAVORITE_MOVIES as t where t::text like '%srk%' The above query would do a search of the string in all the columns…
srk
  • 4,857
  • 12
  • 65
  • 109
0
votes
0 answers

JPA cascade none does not work

Scenario: ` @Entity @Table(name = "a") @AttributeOverride(name = "id", column = @Column(name = "a_id")) public class A { private ... private List<> .... }` ` @Entity @Table(name = "b") @AttributeOverride(name = "id", column = @Column(name =…
bluelabel
  • 1,996
  • 6
  • 29
  • 44
0
votes
1 answer

Attaching JavaSE EntityManager to JTA

I'm working with JBoss Wildfly as an application server on my JPA layer. For technical requirements i need to get my entity persistence manager using the JavaSE/application managed approach. I. e.: EntityManagerFactory emf =…
Alex
  • 1,515
  • 2
  • 22
  • 44
0
votes
1 answer

Is @Table must for a JPA Entity

I am using JPA and hibernate as a JPA provider to connect to my Database. I have got a table in the database with name Candidates and here is my JPA Entity. @Entity public class Candidate { @Id …
srk
  • 4,857
  • 12
  • 65
  • 109
0
votes
2 answers

JPA 2: Order by not working in ManyToMany with extra fields

I have a ManyToMany which I have mapped like this question. Please note, I have removed boilerplate for simplicity @Entity class Person { @OneToMany(mappedBy = "person") @OrderBy("sort") private List adresses = new…
Shervin Asgari
  • 23,901
  • 30
  • 103
  • 143
0
votes
1 answer

How to subclass Hibernate entity class effectively replacing the parent?

Given the following scenario: A project using a framework The framework defines basic entity classes (used for logging, user management etc.) The project has application specific entity classes. I want to subclass a framework class in a way that…
Koraktor
  • 41,357
  • 10
  • 69
  • 99
0
votes
2 answers

Hibernate composed entity

I may be mixing up terms, but what I call a simple entity is something like Customer or Product, i.e., a thing having its own identity and for which I'm using an Integer id. A composed entity is something like CustomerProduct, allowing to create an…
maaartinus
  • 44,714
  • 32
  • 161
  • 320
0
votes
1 answer

JPA Many to many unidirectional

I use spring data jpa and i try to do a many to many unidirectional relation. @Entity public class Appartment { ... @ManyToMany private List featureOption; } @Entity public class AppartmentFeatureOption { @Id …
robert trudel
  • 5,283
  • 17
  • 72
  • 124