Questions tagged [hibernate-5.x]

Hibernate-the object-relational mapping framework for the Java language released new version 5.x with enhanced features like query parser,multi-tenancy improvements,follow-on fetches,OSGi improvements etc.

Hibernate-the object-relational mapping framework for the Java language released new version 5.x with enhanced features like query parser,multi-tenancy improvements,follow-on fetches,OSGi improvements etc.

For more details on Hibernate version 5.x view Hibernate ORM Roadmap

368 questions
4
votes
1 answer

JPA EntityManagerHolder cannot be cast to Hibernate SessionHolder with Spring 5.1 and Hibernate 5.3

In our project, which uses Spring Boot 2.1.3, Spring Data Rest 3.1.5, Spring Data JPA 2.1.5 and Hibernate 5.3.7, we are using some of the new possibilities provided by the changes in Spring Framework 5.1 and Hibernate 5.3 i.e. this one and this one.…
4
votes
1 answer

Hibernate Query executed in @RestController out of @Transactional context

i'm writing an application in spring boot 2.0 and in i have a response of an Entity JPA Mapped with nested object dependency. I load and an entity that is returned to the @RestController and included in response service. I've noticed that a query…
4
votes
0 answers

Hibernate5 - SchemaExport output the script in-memory as string instead to output file on disk

I'm trying to generate some database/table schemas on the fly, using hibernate 5 using something like this: StandardServiceRegistry standardRegistry = new StandardServiceRegistryBuilder().applySetting("hibernate.hbm2ddl.auto", "create") …
Sergiu
  • 2,502
  • 6
  • 35
  • 57
4
votes
1 answer

How to upgrade Hibernate from version 4.3 to 5.2 for migration to JDK 10?

Since JDK8 Oracle announced that no longer support, I am required to upgrade the current JDK to JDK10. After study, the current hibernate is also required to upgrade from hibernate 4 to hibernate 5, in order to run at JDK 10. However, there are…
Cora.Kn.Kwok
  • 71
  • 1
  • 1
  • 6
4
votes
1 answer

How to prevent hibernate5 from lazy fetching when jackson serializes json object?

I'm currently running a spring-boot application where an endpoint returns a Page of a particular object stored in the database. For our purpose lets call that object "x". Within "x" there is a list of objects that are set to be lazily…
Zain Khan
  • 71
  • 1
  • 5
4
votes
1 answer

Hibernate 5.2 get natural id properties from metamodel

Since SessionFactory#getClassMetadata(java.lang.Class) was deprecated, I am not able to use ClassMetadata. I would like to access to the following…
jmgoyesc
  • 2,677
  • 1
  • 18
  • 16
4
votes
1 answer

Hibernate 5 - createCriteria deprecated

I need a help to migrate the code with createCriteria for Hibernate 5, the code is this below: public Curso comDadosIguais(Curso curso) { return (Curso) this.session.createCriteria(Curso.class) .add(Restrictions.eq("codigo",…
Cesar Sturion
  • 147
  • 1
  • 9
4
votes
1 answer

Get Connection object while using SessionFactory.getCurrentSession() in Hibernate

I'm trying to get Connection object in Hibernate when SessionFactory.getCurrentSession() is used. Source code import java.sql.Connection; import java.sql.DatabaseMetaData; import java.sql.SQLException; import org.hibernate.Session; import…
Vicky Thakor
  • 3,847
  • 7
  • 42
  • 67
4
votes
1 answer

hibernate 5 and JPA and setting entity classloader dynamically

I have a web application using a library with a 'CompilingClassLoader' and when it does a reload (because someone edited code), a new classloader is created each time. When that happens, the following code in a hibernate plugin I am writing is…
Dean Hiller
  • 19,235
  • 25
  • 129
  • 212
4
votes
0 answers

How to do not rollback transaction on insert failure (Spring+Hibernate)?

I am writing batch processing. I load CSV file (up to 10.000 rows) and I insert them in database. I do not want my processing to fail in case of duplicates. Is it possible to do such INSERT in single transaction, catch exception for duplicates,…
Bartosz Bilicki
  • 12,599
  • 13
  • 71
  • 113
4
votes
1 answer

Table missing after hibernate upgrade

we have just upgraded from WildFly 9 to 10 and therefore also upgraded from Hibernate 4 to 5. Our application uses entities that are derived from a abstract super entity that has a generated id field. The super class looks like…
Tom
  • 237
  • 1
  • 2
  • 13
4
votes
3 answers

Migration to hibernate core 5.2.1 ava.lang.NoSuchMethodError: org.hibernate.Session.getFlushMode()Lorg/hibernate/FlushMode;

Using spring version:4.3.1,Spring data:1.10.2,hibernate core: 5.2.1. using postgres Database pg connector version :9.4.1208.jre7 After upgrading from hibernate 5.1.0 to 5.2.1 when i am trying to create an entity getting below exception at…
arun kumar
  • 247
  • 2
  • 5
  • 15
4
votes
0 answers

how to export schema in hibernate 5.1.0

I am trying to migrate hibernate from 5.0.3 to 5.1.0. I tried the example that was given on the link below but it did not worked for me. How do I export schema after upgrading Hibernate to 5.1.0? My code for exporting schema in hibernate 5.0.3: …
4
votes
3 answers

Why Hibernate 5.0.6 release package does not contain transaction implementation jar?

I have a code like that: import org.hibernate.Session; import org.hibernate.SessionFactory; import org.hibernate.boot.MetadataSources; import org.hibernate.boot.registry.StandardServiceRegistry; import…
Dmytro Plekhotkin
  • 1,965
  • 2
  • 23
  • 47
4
votes
1 answer

Hibernate 5 with Spring JTA

I am using: Hibernate 5.0.2 Spring 4.2 Atomikos 3.9.3 The official documentation says you only have to set the jtaTransactionManager, and everything works:
Michael Böckling
  • 7,341
  • 6
  • 55
  • 76