Questions tagged [hibernate]

Hibernate is an object-relational mapping (ORM) library for the Java language enabling developers to utilize POJO-style domain models in their applications in ways extending well beyond Object/Relational Mapping.

Filter by
Sorted by
Tagged with
0
votes
1answer
13 views

Hibernate JPA Eager fetching not actually doing anything

I'm trying to use Hibernate's eager fetching to fix an N+1 select problem I am experiencing. I'm trying to do a EAGER fetch of a one-to-many-to-many relationship: In my app, each course has some ...
1
vote
0answers
7 views

spring boot data jpa does not add to the database

I created a spring boot project and created Category, City, Price, Author, Book and Bookstore classes. There is an @ManyToMany relationship between the Bookstore and the Book. All records except ...
0
votes
1answer
8 views

Join Table records are being deleted and created (ORM)

I have a many to many relation in hibernate with extra columns in the join table. When I save the main entity without any impact on the relations between both tables (join table), the record in the ...
1
vote
1answer
14 views

What is the proper way to handle a delete request in a controller?

I have a delete action, mapped out in a Thymeleaf template, but the deleteIngredient method doesn't seem to work. I'm still new to the persistence framework, https request handling, and thymeleaf. The ...
0
votes
1answer
20 views

Unable to Create Table with Relations in MySQL8 from Spring Boot Application

I have been trying to switch from MySQL 5.7 to MySQL 8 for my Spring-Boot Application. I'm using Auto Create-Drop and all the other tables are being created except for one table with a Join. I tried ...
0
votes
1answer
26 views

How do I configure hibernate to use standard logging

How do I configure hibernate to use standard logging ? Articles I read say to put the logging framework on your classpath, but I want to to just use the standard that comes with java so that doesnt ...
0
votes
1answer
22 views

Spring data jpa Constraint Violation exception is not happening on save

I have a simple spring-boot application, I am using spring-data-jpa. While saving the record with the same id I am expecting it to throw the exception, but it's not throwing the exception and ...
1
vote
1answer
32 views

Hibernate JPA @OneToOne Bidirectional Not Working in Spring-Boot

I have Two entities User and Cart with Bidirectional Mapping. when I use a controller to save and Access the entities, I am getting the reference as null. I have used mappedBy on cart but it gives ...
0
votes
1answer
9 views

about autoReconnect=true&useSSL=false

what is "autoReconnect=true&useSSL=false" and why we write it in application.properties ? I have MySql installed on my machine and when i removed that line it wont create any tables in my ...
1
vote
1answer
58 views

Convert String to “yyy-MM-dd” format with Date as data type

I'm trying to get the data stored in database by getting the date then populate the table. List<String> contents = new ArrayList<>(); List<Record> records try { ...
0
votes
0answers
8 views

Force Method to throw an exception in Mockito [duplicate]

I'm having such a method : @PostMapping("/methodToBeMocked") public GenericMessage methodToBeMocked(@QueryParam(value = "msg") Long msg) { try { JmsMessageConstruct.buildId(); b....
0
votes
1answer
15 views

How to fetch particular column data and display it on JSP page using Hibernate JPA join query

I have started learning Spring Boot, Hibernate and JPA, Could not able to figure out how to display particular column data on JSP page fetched from join query. Below added my java code, If I run my ...
0
votes
0answers
11 views

Caused by: org.springframework.data.mapping.PropertyReferenceException: No property name found for type <User>

I am getting the following error on a project: Caused by: org.springframework.data.mapping.PropertyReferenceException: No property name found for type <User> I tried to add: @...
0
votes
1answer
21 views

How to I enable c3p0 logging within my hibernate class

I am using Java 8, Hibernate 4.3.11 and c3p0 9.2.1. I define all my c3p0 properties from within my hibernate config class e.g Configuration config = new org.hibernate.cfg.Configuration(); ...
0
votes
1answer
31 views

Hibernate Pagination Error near limit - SQL server

Hi I am new to hibernate I am trying to do pagination but I am getting an error near the limit, I will really appreciate any help or guide thank you. the error pointing in this line in my code q....
0
votes
2answers
32 views

How to design Entity so that it stores predefined field

Let us suppose that I successfully created a DB table and corresponding java Entity. This entity represents position a worker may take. As the Primary Key it uses incremented id number instead of ...
0
votes
2answers
26 views

When removing a child from list, it deletes the parent as well

I have two classes User and Task. When I remove a child from list, I just want to delete that child, instead it deletes the parent as well. I want to keep the parent(User) but want to remove a child(...
0
votes
2answers
35 views

Spring boot data jpa entityManagerFactory error

I get an 'entityManagerFactory' error. I have model classes called Category, City, Price, Author, Book, Bookstore. Each model class has its own repository. I want to create each one in the Service ...
0
votes
1answer
33 views

Spring Boot 2.x.x compatibility issue with hibernate 4.3.x

I am upgrading my spring boot version from 1.4.4 to 2.0.0 having hibernate version 4.3.11. But it looks like that spring boot 2.0.0 doesn't support hibernate version 4.x.x. Initially, it gives me ...
0
votes
0answers
27 views

How to join json list of identifiers using JPA and hibernate?

I have table foo, identified by fooId, and table bar which contains a json list of fooIds. Example of foo: foo1,"Some random description" Example of bar: bar1,["foo1", "foo2"] I am using ...
0
votes
0answers
13 views

Integrity Constraint saving an object of a class with a one-to-one property migrating hibernate

When I migrated from version 5.3.x to 5.4.x this happened I have a setup like the example at http://websystique.com/hibernate/hibernate-one-to-one-unidirectional-with-shared-primary-key-annotation-...
0
votes
0answers
20 views

Error creating bean with name 'entityManagerFactory' defined in java class

I am following a tutorial for a Spring MVC, Maven, Hibernate and Postgres CRUD system to save users. In this tutorial, it tells me what things do what and the source code. Unfortunatelly, after ...
0
votes
1answer
22 views

How can I get count from joined query - criteria builder

I have a Entity Policy public class Policy extends BaseEntity { private Long id; private String policyNumber; ...... @OneToMany(fetch = FetchType.LAZY, cascade = CascadeType.ALL) @OrderBy(value = "...
1
vote
1answer
33 views

Hibernate error: Method too large (exceeding 65535 bytes size)

My @Entity has 5059 fields (I know... don't tell me), and I am getting the following error when starting my spring boot application with hibernate. My ddl auto is set to "none". My database of choice ...
0
votes
0answers
25 views

How to query over joined tables with a typesafe persistence framework?

I am using JooQ and I want to know, how I can query joined tables in a typesafe way? The framework could also be Hibernate, or anything else that is widely used. Basically what I need is a ...
0
votes
0answers
17 views

Convert a query from postgres query to jdbcTemplate?

So the Postgres query is : SELECT * FROM public.app_catalog as a , (SELECT app_id , COUNT(*) FROM public.statistics_log where logged_at between '2019-08-20 12:22:40.186' and '2019-08-22 12:22:40....
0
votes
1answer
32 views

Create automatically table with hibernate in spring application

I have spring boot application . I will create and update table automatically in java application but my code doesn't work. This is application.properties spring.datasource.driver-class-name=org....
0
votes
1answer
26 views

The object from the JSP page is not returned when it is modified in the form.(data is written to a new object with ID 0)

I pass the ID as a parameter to the edit page, it comes in. In the form, I make changes and when I submit, the POST create a new object and not the one that I edited with the ID passed. I've already ...
0
votes
0answers
21 views

Error executing DDL via JDBC Statement in Spring boot

Yesterday I changed the Entity class name from RecordedPath to RecordedFile and added some extra columns in it. Since than I am getting following error: WARN 6535 --- [main] o.h.t.s.i....
0
votes
0answers
34 views

JPA native query return type

I have the following query Query query = em.createNativeQuery("select systimestamp from dual", Timestamp.class); However, I get the error Missing descriptor for [class java.sql....
0
votes
1answer
33 views

How to use query from postgres properly in a Java JPA repository?

I have this query : SELECT * FROM public.app_catalog as a , (SELECT app_id , COUNT(*) as count FROM public.statistics_log where logged_at between '2019-08-20 12:22:40.186' and '2019-08-22 12:22:...
0
votes
0answers
25 views

Spring hibernate @manyToMany relation with @jsonView infinite recursion

Im having issues with spring and jackson when i try to serialize them I have two classes @Entity @Table(name = "conditions") @Data @JsonInclude(Include.NON_EMPTY) @NoArgsConstructor public class ...
1
vote
1answer
18 views

Query utilizing JPQL does not work as nativeQuery

I have the following sql query which works as expected Query query = entityManager.createNativeQuery("" + "SELECT d.id FROM document d \n" + "INNER JOIN ...
0
votes
0answers
12 views

@OneToMany @JsonBackReference and @JsonManagedReference error in Spring Boot

I have recently been learning Hibernate and Spring, in this project I have a problem with the @ OneToMany relationship, in the Database the names are all right and in the right order can anyone help ...
0
votes
1answer
18 views

How to select only a postgres jsonb column from a table using jpa (hibernate)

I am trying to use JPA to select a column of jsonb data type from a table, an i am having issues achieving that, but i can select others column that are not of the data type jsonb. Here is the ...
0
votes
0answers
12 views

mapping oracle hr schema using hibernate3-maven-plugin

i 've used : <groupId>org.codehaus.mojo</groupId> <artifactId>hibernate3-maven-plugin</artifactId> <version>2.2</version> to create hbm.xml for ...
1
vote
0answers
28 views

Hibernate mssql-jdbc driver generated query (multi column where clause) not supported by MS SQL DB

When I try to get all the rows from a table using my JPA repository the query Hibernate is generating is like this: Select field1, field2, ... from ... where (field1, field2) IN (select f1, f2 from .....
0
votes
2answers
44 views

Hibernate - One to one relation single table inheritance

I have 3 entities BaseFoo, FooAbc, FooAbcDetail. FooAbc extends base entity BaseFoo. I'm trying to do one to one relation between FooAbc and FooAbcDetail. @Data @EqualsAndHashCode(callSuper = true) @...
0
votes
1answer
8 views

Problem: No data type for node: org.hibernate.hql.internal.ast.tree.MethodNode

Here is My Query public List<LocationReviewListDto> findByLocation(Long locationId, Integer page) { return entityManager.createQuery("select com.filmthere.dto.LocationReviewListDto(l.id,...
0
votes
1answer
18 views

Problem about locating Conf. file // Already in src folder

[Folders] : https://prnt.sc/ovyrvd My hibernate config file is already inside of java/src but when i run the code it says : org.hibernate.internal.util.config.ConfigurationException: Could not ...
0
votes
0answers
9 views

I have to get the whole object with maximum column value usinf criteria-api

I have the following hql, but I need to do the same task using criteria API. String hql="FROM LandlordMasterTransaction l WHERE " +"l.caseNo = :caseNo and l.lSlNo = (" +"select max(ll.lSlNo) from ...
1
vote
1answer
20 views

Hql constructor query with null parameter in object

I am trying to join 2 tables and add the result to a new object via a constructor query. Not all ids from the left table are in the right table. Thus via an outer join I expect to get all the results ...
0
votes
0answers
10 views

hibernate @Where clause not working with single value associations with EAGER fetch mode

I am trying soft delete using hibernate @Where. I have Post and PostComment entities with the bidirectional relationship. I added hibernate @Where annotation on both entities and able to filter ...
0
votes
1answer
13 views

How to fix Hibernate Named Native Query's Where clause with IN

This query will return 17 data from the database with IN clause. But if i assigned variable for that it gives 0 in return. Can someone help me what went wrong? Thanks you. ``` @NamedNativeQuery(...
0
votes
0answers
10 views

JNDI lookup in tomee

I have a spring java ee application. It is deployed on a Tomee server. I have defined the data sources in context.xml (in the tomee directory). The jndi lookup works fine if i have the data source ...
0
votes
0answers
11 views

Spring JPA - two way mapping fetch child eagerly

I have two Class Parent @Entity @Table(name = "REPORT_FILTER_TYPE") public class ReportFilterType { public ReportFilterType() {} @Id @Column(name = "FILTER_TYPE_ID",nullable=false) ...
0
votes
0answers
26 views

Java POJO for multidimensional Multiselect

I am currently trying to implement an POJO and DB Mechansim (save / load) for a multidimensional multiselect component (Angular) (hope this is the correct term). What i mean is following component (u ...
0
votes
1answer
24 views

Hibernate - One To One IdentifierGenerationException

I have two entities like as below @Data @EqualsAndHashCode(callSuper = true) @Entity @Table(name = "foo") @Audited @AuditOverride(forClass = Auditable.class) public class Foo extends Auditable ...
0
votes
1answer
36 views

How to use common entity in more than one entity

I have one entity Address and this entity is owned by two other entities. Ex @JoinColumn and mappedBy use foreign key either for User or Company. How to fix this problem to work address for both ...
0
votes
0answers
4 views

In Hibernate second level cache n data base data not in sync, how to solve this issue

In hibernate if the second level cache data is not in sync with database data and the application still fetching data from the second level cache we may end up with getting dirty data. Is there any ...