Questions tagged [hibernate-entitymanager]

Hibernate EntityManager implements the programming interfaces and lifecycle rules as defined by the JPA 2.0 specification.

Hibernate EntityManager implements the programming interfaces and lifecycle rules as defined by the JPA 2.0 specification. For more informatio refer the link.

288 questions
0
votes
0 answers

Running SpringBoot 3 application with Security Configuration

I upgraded the application I have from java 8 to java 17, and springboot 3. and the app stopped running. I have one repo: I used ListCrudRepository instead of PagingAndSortingRepository which is not used in the current springboot…
0
votes
0 answers

cache them all with hibernate

I'm using hibernate-entitymanager with c3p0. My app does not create any "dynamic" queries using createQuery(...) nor createNativeQuery(...) etc: only "named queries" and automatically generated queries from entity classes. Assuming that I want to…
morgwai
  • 2,513
  • 4
  • 25
  • 31
0
votes
1 answer

Spring Data JPA/Hibernate: How to make entities read-only incl. their lazily-loaded relationships? Without using @Immutable

Scenario A Spring Data JPA/Hibernate based application with @Transactional services, thus entities are managed by the persistence provider with no explicit invoking of save/update/persist. Now, I'd like to implement a read-only repository/service…
0
votes
0 answers

How can I inject a real instance of EntityManager in Spring Boot unit tests?

While attempting to use the EntityManager to get access to my Hibernate Metamodel, I realized that any time I tried the following, my unit test would get stuck on initialization. The test wouldn't spit out any error logs, but instead would continue…
0
votes
1 answer

Gettingn Oracle error PLS-00306: wrong number or types of arguments in call to stored procedure, and can't find where

I am new to Oracle and I am using Spring and Hibernate. I am trying to call a stored procedure from Oracle and execute it, but I am getting an error in my logs that haven't pinpointed me to where in the SQL query things are wrong. Additionally, I am…
0
votes
1 answer

Hibernate maps full relational object only in first occurance in the aggregation

Problem I have stumbbled upon is the relation below in my RestApi. While requesting for all payments Object having PaymentCategory in relation is fully returned. But when PaymentCategory in the List is present for the next time, then the Payment…
0
votes
2 answers

insert the list parameter into the nativeQuery

I have a query like this that works well : "SELECT * FROM elements we WHERE jsonb_exists_all(CAST(we.elements AS jsonb), ARRAY['TEST'])" I need to use the .setParameter method from EntityManager to insert a whole array instead of ["CHEST"] e.g.…
0
votes
0 answers

Spring boot JPA Hibernate - Old generation memory not being freed up

We are using Spring boot 2.6.6 (Java8) which internally pulls in hibernate version 5.6.7.Final. Database used is Oracle 19c. We are using "saveAll" method of JPA repository to do batch insert/updates for entities but observing that the old…
0
votes
0 answers

How to call complex Stored Function using Entity Manager?

I am trying to call this using JPA/Hibernate EntityManager bu I keep getting errors. Essentially this is a stipped-down version of a PL/SQL function. FUNCTION create_foo(f_name VARCHAR2, l_name VARCHAR2, …
0
votes
1 answer

Entity Not Updated in Database

I was trying to update entries in the package using EntityManager but its entity is not getting updated for some reason. I was using entityManager.merge(entity) to update. Any suggestions on how to fix or debug?
0
votes
0 answers

Failed to initialize to Spring boot code Error creating bean name "entityManagerFactory" defined class path resource Invocation of init method failed

Error persist 2022-10-29 20:35:41.223 INFO 8944 --- [ restartedMain] org.hibernate.dialect.Dialect : HHH000400: Using dialect: org.hibernate.dialect.MySQL5InnoDBDialect 2022-10-29 20:35:41.546 ERROR 8944 --- [ restartedMain]…
0
votes
0 answers

Hibernate error "Session/EntityManager is closed" when a query is reused

A bean method shown below throws exception at the marked line: @Repository public class RepoImpl implements Repo { @PersistenceContext private EntityManager em; ...... ...... @Override public List
HEssaidi
  • 33
  • 2
  • 8
0
votes
1 answer

Quarkus dependency app using different persistence unit triggering errors related to EntityManager

I've got the following class inside a primary quarkus application (named dep-repos) I've created: package com.myapps.dep.common; @ApplicationScoped public class DepRepository implements PanacheRepositoryBase { @Inject …
Briston12
  • 357
  • 3
  • 15
0
votes
0 answers

Different schemas with one single EntityManager

I am working in an old, enormous java application with JPA. I want to make as less changes as possible. The custom framework this application is based on provides one EntityManager instance set up for one specific DB schema. Can i somehow set that…
deevelop
  • 35
  • 4
0
votes
1 answer

How to save TimeStamp in single column using hibernate

How do I save timestamps in mysql DB using a hibernate entity in specific format. Hibernate Entity Class: @CreationTimestamp @Column(name="created_on", nullable = false, updatable = false) private LocalDateTime…