55 questions
0
votes
1
answer
48
views
Remove a entry from hibernate collection without fetching entire collection
Using Hibernate, I have bi-directional association between person/address. Person entity can have too many addresses and I want to add and remove to address collection without loading entire ...
0
votes
1
answer
758
views
Hibernate6.2-JPA: Could not determine recommended JdbcType for <Custom class>
I am using Java 17 with spring boot version 3.1.0, Hibernate 6.2.2.Final & postgresql 12.
Running into "Could not determine recommended JdbcType for" error when inserting the data into ...
0
votes
1
answer
116
views
microprofile-openapi-api 2.0 switches off hibernate-jpamodelgen
I have a java microservice-project with theese two dependencies defindes in my gradle.build file:
implementation(group: 'org.eclipse.microprofile.openapi', name: 'microprofile-openapi-api', version: '...
0
votes
0
answers
182
views
Spring data jpa with hibernate is failing on PK (primary key) violation during save and flush execution
I'm upgrading from Spring 4.3.23.RELEASE to Spring 5.3.20 and running into issues with the save and flush of the record due to that Spring is not using the correct next available key value from the ...
0
votes
2
answers
6k
views
HikariPool-1 - Exception during pool initialization with SpringBoot and Hibernate and JPA Repository
HikariPool-1 - Exception during pool initialization when trying to run spring-boot application. While running mvn spring-boot:run command, the logs show repositories initialized and server starts and ...
0
votes
1
answer
2k
views
No Persistence provider for EntityManager Error
I am getting this error "No Persistence provider for EntityManager named" and not able to proceed.
I am learning hibernate and trying so hands on stuff.
I tried all the methods mentions in ...
0
votes
1
answer
2k
views
Could not initialize class sun.security.ssl.SSLExtension when deploying spring boot with mssql database to glassfish 5.1
I am new to glassfish server and I am trying to deploy a Spring boot application in glassfish 5.1.
My Spring boot application communicates with database via JPA and Hibernate.
When I compile and ...
1
vote
1
answer
1k
views
How to setup Hibernate JPA in Spring-Boot project without Spring Data?
I am quite new to Spring and have a task to create a multi-module project that needs to use Hibernate JPA and Spring-Boot (Spring Data JPA is not allowed for this project).
I am using the PostgreSQL ...
0
votes
1
answer
109
views
How to return the genarated ID in CrudDAOImpl.java when using Hibernate-JPA
I use the hibernate-JPA implementation (v5.6.1.Final) in my project.
I have implemented the data access layer as follows:
Class Visualization Diagram.
1.1 Employee.java Entity
package com....
0
votes
1
answer
100
views
How can I make sql generated by Hibernate use in operators over equality operators
What I want is a way for Hibernate to generate 1 statement to delete all children, instead of 1 statement per child.
If I have a relationship between Entity A and B , where A is the parent and B can ...
3
votes
1
answer
3k
views
EntityManager refresh() method does not refresh but resets
The em.refresh(person) in the following code does not work. Rather than refreshing the person with a fresh value from database, it resets (undo or discards) the changes made in the cache. I am not ...
0
votes
1
answer
796
views
Spring JPA: keeping the persistence context small
How can I keep the persistence context small in a Spring JPA environment?
Why: I know that by keeping the persistence context small, there will be a significant performance boost!
The main problem ...
2
votes
0
answers
456
views
Searching into postgres Jsonb column using CriteriaBuilder JPA
I am facing issues while retrieving/searching through Postgres JSONB column using CriteriaBuilder.
Postgres Query : SELECT * FROM table where lower(jsonb_extract_path(tags,'Case')::text) = lower('&...
0
votes
1
answer
654
views
Issue in persistence.xml for Oracle DB
I am getting below error :org.xml.sax.SAXParseException; lineNumber: 4; columnNumber: 77; schema_reference.4: Failed to read schema document 'http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1....
0
votes
2
answers
697
views
Unable to remove foreign key constraint in hibernate
I am trying to delete one object from my project.
It is dependent on many other classes. I understand that I need to free that object from all other dependencies. I tried to delete all its ...
3
votes
1
answer
2k
views
I get an "Invalid persistence.xml" with createEntityManagerFactory but not @PersistenceContext
I have a project where we use Hibernate-jpa-2.1 and get an EntityManager istance both in this way
@PersistenceContext(unitName = "common-api")
EntityManager em;
and this
em = ...
0
votes
1
answer
400
views
java.lang.Exception: Not an entity: class com.domain.package.User
I am migrating entity mapping from an annotations app to hbm.xml
I error this error and not found the solution. Thanks
java.lang.Exception: Not an entity: class com.enterprise.package.user.domain.User
...
0
votes
1
answer
158
views
Quarkus extension for spring data API - automatic repository implementation generation
I am trying to migrate a spring project in quarkus and I am using quarkus extension for spring data API.
As they said in the quarkus doc : Interfaces that extend org.springframework.data.repository....
3
votes
1
answer
3k
views
Micronaut data native-image: No bean of type [io.micronaut.data.operations.PrimaryRepositoryOperations] exists
I'm working on a new example by using Micronaut, Micronaut Data, JPA, Postgres, and GraalVM, following
https://github.com/rmondejar/micronaut-postgres-example
This example has been created by using ...
1
vote
2
answers
10k
views
Caused by: java.lang.IllegalArgumentException: Property 'driverClassName' must not be empty
In the code I have shared here Exception in thread "restartedMain" java.lang.reflect.InvocationTargetException Caused by: java.lang.NullPointerException I am getting new error. Could you ...
1
vote
2
answers
83
views
how I obtain only two attribute of my class
I have a problem with the controller, it is returning the whole User Instance while I only need to return attribute which are : "email" and "password".
The problem exists in the public String login (...
2
votes
1
answer
466
views
How to test Hibernate JPA persistence layer?
I need to write tests for data access (Hibernate persistence actions) because I want to know that it works as expected even if I upgrade Hibernate version. So what is the best way to do it with Junit??...
0
votes
0
answers
395
views
OneToOne mapping issue for non primary field
I am trying to map a non primary key column between 2 tables using one-to-one mapping through JPA.
The OneToOne is not performing the join on the mentioned column rather it is picking up the Id field....
1
vote
0
answers
137
views
Weblogic 10.3.3 :: java.lang.NoSuchMethodError: javax.persistence.spi.PersistenceUnitInfo.getSharedCacheMode()
I get the error
Caused By: java.lang.NoSuchMethodError: javax.persistence.spi.PersistenceUnitInfo.getSharedCacheMode()Ljavax/persistence/SharedCacheMode;
at org.hibernate.ejb.util.LogHelper....
1
vote
0
answers
809
views
JPA update only if model exists
em.merge is not an option because I don't want a new row if the id doesn't already exist. Also, it calls an extra select.
I don't want to do find and then call merge as it will again be extra selects.
...
0
votes
0
answers
249
views
After Hibernate JPA persist - record is not in the database
I face following issue while trying to write some JBehave BDD test. Scenario is the following:
Due to an MQ message some specific records should be saved into my database and some should be deleted ...
0
votes
2
answers
562
views
How to find if a result is falling between 2 dates in the lucene index?
I'm trying to find if the expiry date falls between today and another date specified. Though my database has results, the search query doesn't seem to fetch the value. Please help!
This is the query ...
0
votes
1
answer
2k
views
org.hibernate.hql.ast.QuerySyntaxException: unexpected token: jpa
After adding AND condition to the below mentioned query
String querys = "SELECT dr.id,dr.creation_time,dr.drawing_spec_format,dr.end_time,dr.error_type,dr.last_access_time,dr.server_name,dr....
0
votes
1
answer
55
views
Implement JPA request with JOIN
I have these 3 entities:
Payment Transactions:
@Entity
@Table(name = "payment_transactions")
public class PaymentTransactions implements Serializable {
@Id
@GeneratedValue(strategy = ...
0
votes
0
answers
85
views
How to use two joins in jpa in topredacte method
I am using a jpa with spring boot and I'm newbie with this. I have override
Predicate toPredicate() of Specification. below is my code:-
public Predicate toPredicate(Root<ExportOrderInfo> ...
0
votes
0
answers
2k
views
How to use specification for a custom JPQL query
Is there any way to add Specification for a custom JPQL query like below :
I am able to create custom jpql, but not sure how to add additional specification conditions to it. I need to add ...
2
votes
1
answer
701
views
date field with CreationTimestamp throw PropertyValueException: not-null property references a null or transient value
I am using web-services with spring-boot 2.0.6 and hibernate 5.2.17. When I save an object with a createTime field of @CreationTimestamp, @Column(nullable = false) and @Temporal(TemporalType.TIMESTAMP)...
0
votes
1
answer
208
views
How to fetch an entity having a timestamp property that is within an hour from other timestamp property with JPA and Hibernate
I have a doubt in JPA query criteria builder with path or expression.
I want to find who are all entered first post comment with in an hour after their account created
Path<Date> ...
1
vote
0
answers
2k
views
JPA "update" query stuck and locks all Database
I have an update query that sometimes gets stuck and locks the entire database. I have to ask the DBA to kill the query manually whenever this occurs. The status of the query in the db is "sleeping", ...
0
votes
1
answer
743
views
"ERROR: ORA-00911: invalid character " for create tables by Hibernate JPA
I want create two tables with Hibernate JPA .
I use Oracle 11g and JDBC 6 & 7 (Because I'm not sure which one is suitable for 11g :) ).
my library : hibernate-release-4.2.0.Final & ...
0
votes
1
answer
246
views
Grouping columns within entity
I have a table with 2 columns for phone number(area code and number). When I define entity, I can do it with 2 different variable to match column names.
However, when i use it in jparepository, I want ...
0
votes
1
answer
2k
views
Map sql query result to java object(in Non-Entity class) using spring jpa
I want to assign SQL query result to Java object which is in non-entity class.
My query is counting the number of records in Table A mapped to another Table B.
@Query(value="select count(a.id) from ...
-1
votes
2
answers
679
views
Hibernate @OneToMany Mapping fetching records
I have googled everywhere but unable to get what I need
Unable to get the respective output.
I have two classes Employee and EmployeeLocation and their respective tables in SQL.
This is my table ...
1
vote
1
answer
1k
views
findAllBy JPA with embeddedId
I have this Document hibernate jpa entity with an EmbeddedId:
@Entity
data class Document(
@EmbeddedId
@NotNull
val documentExpertId: DocumentExpertId,
// other fields
...
1
vote
1
answer
406
views
Java Nifi Processor with Hibernate JPA
I'm trying to use a hibernate JPA from my custom Nifi processor written in Java.
From inside the processor i don't have any information about connection string, username, password etc (because in the ...
0
votes
0
answers
308
views
JPA error in merge: Password expired error if insert only
We are using entitymanager merge method to either update (if existing) or insert (if not existing) records in a certain table. What happens is if it is an update, there are no errors, but if it is ...
0
votes
1
answer
993
views
How to avoid child of child objects in Spring JPA?
I am using Spring JPA.
I have three entities Student, ClassRoom and School like below
@Entity
public class Student implements Serializable {
private static final long serialVersionUID = 1L;
@...
3
votes
0
answers
1k
views
how to set hibernate query timeout
I am new to Hibernate and using the following versions of Hibernate:
hibernate-core-4.3.11.Final
hibernate-jpa-2.1-api-1.0.0.Final
I am trying to set a timeout on a query. The Query class of ...
2
votes
1
answer
3k
views
Deleting Hibernate entity that has a foreign key in database
I have already looked into this issue that I am having and tried to remove the AccountBalance from the Set in the corresponding Account Hibernate class, and then saving the Account object, but the ...
1
vote
0
answers
975
views
Spring Data Rest returning null values for Parent and Child entity
I have an implementation with Spring Rest Data for a Employee and Department class. However when I try to fetch the data using rest template, the id is always comes null for both the entities but with ...
0
votes
1
answer
538
views
Hibernate JPA is generating select query everytime when findOne(String id) is called with same parameter value
Hibernate findOne(String id) is taking to much time (more than 300ms) in our case. This is not consistent as well. For some request, it is returning the result in less than 100ms.
So we want to ...
0
votes
2
answers
3k
views
hibernate JPA unknown column in 'field list'
I am writing a spring boot + Hibernate JPA application and i my hibernate code is not working in that below are the details
Entity Class:
@Entity
@Table(name="user")
public class UserBean {
@...
2
votes
0
answers
10k
views
org.apache.catalina.LifecycleException;failed to start component
After deploying/replacing the class files in Tomcat 8 I got the following error. I haven't been able to find (or properly implement) a solution to the problem at hand yet. Any help would be ...
0
votes
1
answer
2k
views
Spring boot routing datasource not work correctly
I am configuring spring boot web app with Postgres, Hibernate, Atomikos, JPA and Thymeleaf.
I use AbstractRoutingDataSource to route to new datasource as below:
@Override
protected Object ...
0
votes
2
answers
828
views
JBoss WildFly 11, Hibernate ORM 5.2, OGM 5.3 and MongoDB - OgmIntegrator not found
Progressing slowly through trying to get Hibernate ORM 5.2 working with OGM 5.3 so I can use JPA with MongoDB.
To remove the JNDI look-up error, referenced in the OGM FAQs:
When using Hibernate OGM ...