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.

Filter by
Sorted by
Tagged with
0 votes
0 answers
22 views

Print hibernate sql query with parameters into logs

I am able to print SQL query and binded params but not the limit values. I am using hibernate 5.2 and spring boot 2.2.3 and log4j2 for logging. I am able to print in a different log file by enabling ...
Usha's user avatar
  • 194
0 votes
0 answers
142 views

registerFunction removed from hibernate 6

We are Migrating from springboot 2 to 3 which includes hibernate 5 to 6 migration public class ExtendSqlServer2012Dialect extends SqlServer2012Dialect{ public ExtendSqlServer2012Dialect(){ ...
anil's user avatar
  • 1
0 votes
0 answers
43 views

Hibernate 5.3.20.Final : multiple bean creation issue

I've updated hibernate core, entity-manager from 4.3.1 to 5.3.20,but once I upgrade multiple beans are getting created for sessionFactor, & for EntityMangerFactory getting this below error Caused ...
Prathamesh Tamte's user avatar
0 votes
1 answer
69 views

SQL Sequence mapping - SqlServer2012SpatialDialect, Grails 4, Hibernate 5 compatibility

So far in the configuration file (application.yml) hibernate-dialect has been set as follows: dataSource: pooled: true jmxExport: true driverClassName: com.microsoft.sqlserver.jdbc....
lujjas's user avatar
  • 68
0 votes
0 answers
60 views

Upgrading spring from 3.0.5.RELEASE to 5.1.8.RELEASE and hibernate from 3.3.1.GA to 5.6.12.Final, getting error "no transaction is in progress""

I am using two dataSource x and y in my project. and using 2 transactionManager tmx and tmy respectively for that. Enable synchronization for tmy with SYNCHRONIZATION_ALWAYS and not enable for tmx ...
dadhaniya darshan's user avatar
1 vote
3 answers
4k views

Migration from Hibernate 5 to 6

I am trying to migrate a spring boot 2.3 application running on java 8 to spring boot 3 java 17. The issue is in a repository. It has a query method as follows: @Query(value = "SELECT ca FROM ...
ahrooran's user avatar
  • 929
0 votes
0 answers
81 views

Error after updating Hibernate 5.2 to 5.4: “Caused by: org.h2.jdbc.JdbcSQLException: Data conversion error converting "aced000573720 … 710";

I'm trying to upgrade Hibernate core from 5.2 to 5.4. Integration tests work fine with Hibernate 5.2, but when upgrading to 5.4, this error showed ERROR: javax.ejb.EJBTransactionRolledbackException: ...
Khanh's user avatar
  • 1
0 votes
0 answers
55 views

After upgrading Hibernate 4 to Hibernate 5, couldn't connect to the MySQL 8 database

java.sql.SQLNonTransientConnectionException: Could not create connection to database server. Attempted reconnect 3 times. Giving up. at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(...
SRI PRIYA's user avatar
0 votes
0 answers
110 views

Hibernate 5 retrieve DataBaseMetadata || Spring boot || Java

In hibernate 5 the classes have changed to retrieve DatabaseMetadata, with DataBaseInformationImpl, but in those changes, there is no specific method that describes how to get DataBaseMetadata, ...
Prathamesh Tamte's user avatar
2 votes
0 answers
468 views

Querydsl`s JPASQLQuery uses java.sql.Date instead of java.time.LocalDate

I have a simple PostgreSQL table: CREATE TABLE public.test_entity ( id int8 NOT NULL, title varchar NOT NULL, created_at date NOT NULL, CONSTRAINT test_entity_pkey PRIMARY KEY (id) ); ...
Anatoliy Golubev's user avatar
0 votes
0 answers
28 views

Custom CalendarType in Hibernate 5 not working

I have a custom CalendarType that overwrites the set method after upgrading to hibernate 5 it no longer calls this method any idea why ? public class CustomCalendarType extends CalendarType { ...
GreenThreading's user avatar
0 votes
2 answers
405 views

Are Restrictions and Projections deprecated from Hibernate 5.2 onwards?

Are Restrictions and Projections deprecate from Hibernate 5.2 onwards? If so what are the JPA Criteria API equivalents. Other Related Q's - Does the Hibernate Criteria Extensions API (which supports ...
samshers's user avatar
  • 3,019
1 vote
1 answer
368 views

EntityManager in CustomRepository with CRUDRepository throwing error

I am trying to use customRepository with CRUDRepository. Getting below error: ConfigRepository defined in @EnableJpaRepositories declared on JpaRepositoriesRegistrar....
Radha S's user avatar
  • 61
1 vote
1 answer
559 views

Hibernate 5 migration Issue with Multilevel Joined table Inheritance with Hibernate 5.4 DiscriminatorColumn

I am working on migrating a legacy Hibernate project from version 4.1 to 5.4. The code has Multilevel Joined table inheritance using a dedicated DiscriminatorColumn. The code was working fine in ...
Diablo's user avatar
  • 453
0 votes
1 answer
710 views

JPA allocation Size causing Auto Generated Sequence to Reused after AllocationSize

I have recursive parent and child relation for Graph. When I have a large Graph with 50 or more nodes on a Single hibernate session, I get an error message "A different object with the same ...
Bmis13's user avatar
  • 550
0 votes
1 answer
44 views

What is the replacement for EntityManagerFactoryRegistry.getNamedEntityManagerFactory in hibernate 5.x

I was using EntityManagerFactoryRegistry.getNamedEntityManagerFactory from hibernate-entitymanager:4.2.18 but when i update to 5.x i see that this class is no longer available. In fact hibernate-...
JMBA's user avatar
  • 79
0 votes
0 answers
2k views

Dynamic Table name in Spring boot JPA

My requirement is to change the table name while inserting the records. I want to change the table name to users_myCompany where myCompany will change for each and every query. Example: I have a api ...
Sharath's user avatar
  • 76
0 votes
1 answer
617 views

How to match numeric and boolean values in a lucene query

I am using hibernate search to construct a lucene query that returns string values that contain (part of) the search string. Next to that the query must only return the string values if the language ...
Maurice's user avatar
  • 6,703
1 vote
1 answer
78 views

Migrating Hibernate3 to Hibernate5, Formatter class

How can I edit this piece of code used with hibernate 3 in order to corresponds to hibernate 5.6.1 version. I see that Formatter is now an interface with one single method.
andy's user avatar
  • 61
2 votes
1 answer
284 views

Hibernate 5 Schema-validation: missing table with HBM files

This problem is very similar to one I had before. I am converting an existing non-Spring application from Hibernate 3.x to the very latest 5.6.0.Final (at this time). We are using the MariaDB in AWS ...
tjholmes66's user avatar
  • 1,850
0 votes
1 answer
165 views

Defining Hibernate 5 FilterDefinition by code

We have a project using Hibernate 3.6.10, and now we are planning to upgrade the Hibernate version to 5.6.0. One problem we have found is in old Hibernate it was possible to register FilterDefinition ...
Amir Pashazadeh's user avatar
0 votes
1 answer
594 views

Register Hibernate 5 Event Listeners

I am working on a legacy non-Spring application, and it is being migrated from Hibernate 3 to Hibernate 5.6.0.Final (latest at this time). I have generally never used Hibernate Event Listeners in my ...
tjholmes66's user avatar
  • 1,850
0 votes
1 answer
2k views

Upgrading hibernate version to 5.4 gives me 'no transaction is in progress'

I am trying to upgrade spring version(4.3) and hibernate version(5.4) and I am getting 'no transaction is in progress' exception, I am using HibernateTransactionManager and also I have tried with ...
Mohamed Azarudeen's user avatar
0 votes
0 answers
56 views

hibernate 5 order of execution in inserting onetoone entities

I have very complex structure with multiple tables to simplify I will post small example I have 4 entities A -> entityId B -> entityId (A- -Onetoone B) C -> entityId (A- -Onetoone C) D -> ...
Gaurang Sheth's user avatar
1 vote
1 answer
551 views

Hibernate support for JDBC specification 4.3?

In the docs for Hibernate ORM 5.4 it states that the System Requirements require at least Java 1.8 and JDBC 4.2. The same can be found for the docs for version 6.0. Hibernate 5.2 and later versions ...
Navigatron's user avatar
  • 2,065
2 votes
0 answers
241 views

Why can't persist data into database

I am getting: Can not set java.lang.Integer field com.springboot.Model.departmentModel.id to com.springboot.Model.departmentModel in my Spring Boot Project trying to persist data into database... ...
Faheem azaz Bhanej's user avatar
3 votes
1 answer
2k views

Upgrading to Hibernate 5: how to get type mapping now that TypeResolver is deprecated

I'm working with an older codebase which has a LOT of entities using enums like this (currently using Hibernate 3), with a "generifying" GenericEnumUserType class: @Entity @Table(name = &...
Vlad L's user avatar
  • 1,574
3 votes
0 answers
165 views

How to prevent JPA/Hibernate attempts to delete from (read-only) DB view mapped Map property?

I have something like this: @ElementCollection(fetch = FetchType.LAZY) @CollectionTable(name = "my_read_only_view", joinColumns = {@JoinColumn(name = "entity_id", ...
Learner's user avatar
  • 1,215
1 vote
0 answers
149 views

Hibernate 5: Count value returned as java.time.Duration instead of java.lang.Long

While trying to fetch Count(*) using Hibernate 5.4.17, the count value (from nativeQuery.uniqueResult() below) is being returned as java.time.Duration, when the same used to be returned as java.lang....
Rohan Bhattacharya's user avatar
1 vote
1 answer
4k views

"Could not obtain transaction-synchronized Session for current thread" error in Spring transaction management

I am working on migrating an application from Spring 3.2 to Spring 5. The application uses AWS RDS with a primary database as primary or master datasource and a replica database as read-only ...
mambo's user avatar
  • 9
3 votes
0 answers
689 views

setMaxResult(0) returning an empty List in hibernate 5.2.6+ but which was not the case in prior versions

I am migrating the hibernate version from 5.0.12.Final to 5.4.28.Final and I had performed some obvious straightforward deprecated changes like changing org.hibernate.Query to org.hibernate.query....
Prasanth Rajendran's user avatar
1 vote
0 answers
211 views

How to annotate a property so that it is "lazy" but so that it also reacts to entity graphs?

I am learning how to fully control Hibernate behaviour and have hit a roadblock: if I annotate my @ManyToOne entity properties one way they aren't lazy "enough" but if I annotate them ...
Learner's user avatar
  • 1,215
3 votes
1 answer
8k views

Spring Boot Hibernate not picking up use-new-id-generator-mappings property

I'm upgrading my project to Spring Boot 2.1.18 that uses Hibernate 5.3.18. Previously, my entity looked like thus and would use the SequenceHiLoGenerator: @Entity @Table(name = "group_link") ...
AHungerArtist's user avatar
0 votes
0 answers
373 views

How to lock() a JPA/Hibernate entity when all one has is that entity (no EntityManager/Session)?

I am dealing with some legacy code that, in places, does not have a clean and reliable way of obtaining a JPA EntityManager (or Hibernate Session) for a given entity as needed to invoke a lock(...) ...
Learner's user avatar
  • 1,215
1 vote
1 answer
670 views

SpringOrm-Hibernate 4 to 5 migration issue - need to mutate metadata before building sessionFactory

I'm trying to upgrade from Hibernate 4.3.11 to 5.4.x with Spring-Orm 4.3.29. As part of the upgrade, I need to migrate existing custom logic that is dependent on NamedSQLQueries retrieved from ...
Vicky's user avatar
  • 11
1 vote
2 answers
364 views

Hibernate: getting error to run this SQL query "alter session enable parallel dml" in Hibernate 5.4.x version

I have upgraded Hibernate 4.x version to Hibernate 5.4.x version in my application. I am getting below error while running below SQL query: javax.persistence.TransactionRequiredException: Executing ...
user3552342's user avatar
1 vote
0 answers
2k views

Hibernate 5 java.lang.NoSuchMethodError: org.hibernate.engine.spi.SessionFactoryImplementor.getProperties()Ljava/util/Map;

I have a legacy application which I am migrating to java 11. After migrating and doing relevant changes, if I run my application is eclipse, it runs fine and gives the desired output. Problem comes ...
Sourav Roy's user avatar
0 votes
1 answer
491 views

Hibernate - Column of Embedded missing in Audit Table

I am using hibernate version 5.3.18.Final but I face an issue with the Embedded object with the Audit table Caused by: org.hibernate.tool.schema.spi.SchemaManagementException: Schema-validation: ...
Mina Fawzy's user avatar
  • 20.9k
2 votes
1 answer
2k views

Hibernate - Subclass has to be binded after it's mother class

after upgrading hibernate to from version 4.3.7.Final to 5.3.18.Final I got the error below @Entity @Audited @AuditPermission(Permission.VIEW_INDIVIDUAL) public class Individual implements ...
Mina Fawzy's user avatar
  • 20.9k
2 votes
2 answers
3k views

java.lang.ClassCastException: [B cannot be cast to [Ljava.lang.Object; while using JPA 2.2 query.getResultStream().findFirst()

The code of my Spring Data repository method is as follows: public Optional<byte[]> findShipmentLabelByClientIdAndAwb(String clientId, String awb) { String queryString = "select g....
Dragoş Haiduc's user avatar
1 vote
2 answers
487 views

Hibernate 5: using named query with stateless session returning java.lang.UnsupportedOperationException

after we upgrade our project from hibernate 4 to 5, we have been getting this exception where we are trying to get scrollable result from named query with stateless session. so far we have tried ...
Zunaira Shafique's user avatar
0 votes
1 answer
1k views

Using jpa2.2 on Websphere with spring/hibernate

I recently inherited a Spring/Hibernate app, and upgraded it to Spring 5.2.8, SpringSecurity 5.3.4, Hibernate 5.4.21. We are deploying on Websphere 8.5.5 (full, not liberty). When I try to run the ...
simonalexander2005's user avatar
0 votes
1 answer
1k views

strange behavior [Spring boot upgrade 2.2.2]Getting java.lang.NullPointerException: null at org.hibernate.loader.custom.sql.NamedParamBinder.bind

java.lang.NullPointerException: null at org.hibernate.loader.custom.sql.NamedParamBinder.bind(NamedParamBinder.java:34) at org.hibernate.loader.custom.CustomLoader.bindParameterValues(...
Viral Kondhia's user avatar
1 vote
0 answers
81 views

org.hibernate.tool.hbm2ddl.SchemaUpdate does not add new columns to existing table definitions

We recently upgraded from Hibernate 4.3 to Hibernate 5.4. Previously we used to use invoke the SchemaUpdate in the following manner new SchemaUpdate(sessionFactory.getConfiguration()).execute(false, ...
Harper Dollin's user avatar
1 vote
2 answers
218 views

What exactly hibernate enableExtendedEnhancement does?

I know this might not be the right place to ask a question like this, but so far enableExtendedEnhancement is not documented and I was not able to find any resources on this topic. Please explain this ...
Silvio Marijić's user avatar
0 votes
1 answer
139 views

Hibernate 5: upgrade

I am upgrading to Hibernate 5 from 4. I am getting below error while application startup. org.hibernate.hql.internal.ast.QuerySyntaxException: unexpected token: FETCH near line 1 The named queries ...
Sanjay's user avatar
  • 165
0 votes
1 answer
2k views

Configuring Hibernate Entity Listeners for only group of entities

As per https://vladmihalcea.com/hibernate-event-listeners/, I would like to configure entity listeners for post insert/update/delete events for my group of entities. I do not want these listeners for ...
rockycres's user avatar
0 votes
0 answers
113 views

JPA2 criteria query for @OneToMany relation using a hidden column without a field mapping

I have an entity Instrument with these fields: @OneToMany(fetch = FetchType.EAGER, cascade = { CascadeType.PERSIST, CascadeType.MERGE }) @JoinColumn(referencedColumnName = "instrumentId", nullable = ...
Aaron Digulla's user avatar
1 vote
2 answers
801 views

Hibernate custom sequence generator - Table doesn't exist

I'm using a custom class to generate id: public class StringPrefixedSequenceIdGenerator extends SequenceStyleGenerator Also using this class on entity attribute: @Id @GenericGenerator(name = "...
Aldo Inácio da Silva's user avatar
6 votes
2 answers
3k views

NullpointerException with hql query in Hibernate NameGenerator

i have an issue with hql queries which contain a null in the select, for example: "select firstname, lastname, null from Employer" The Nullpointer comes from: Caused by: java.lang....
Johannes Hinkov's user avatar

1
2 3 4 5
8