hibernate Questions

27

I am using hibernate JPA with spring and mongodb and I am running my application on Glassfish-4.0. My service class is: @Component public class Test { @PersistenceContext EntityManager em; Entit...
Amharic asked 13/9, 2014 at 9:3

8

I am executing the following HQL and it is executing properly String hql = "FROM Employee"; Query query = session.createQuery(hql); List results = query.list(); Now, I also want to log the sql ...
Serenity asked 22/8, 2013 at 14:54

10

Solved

I am getting this exception when I call a DAO method which uses SessionFactory.getCurrentSession(). The DAO class is annotated with @Transactional and I also have <tx:annotation-driven/> decl...
Diamond asked 10/2, 2011 at 19:24

2

Solved

So How to check if a collection is null in HQL? Simple example: select * from Book book where title in (:titles) So if titles is a single variable, I can do select * from Book book where (:tit...
Amey asked 16/7, 2018 at 21:54

11

Solved

How can I set a Hibernate Parameter to "null"? Example: Query query = getSession().createQuery("from CountryDTO c where c.status = :status and c.type =:type") .setParameter("status", status, Hiber...
Harlow asked 23/1, 2010 at 14:21

2

Solved

I have this JUnit code and it works without problems in Springboot 3.1. But when I updgrade to Springboot 3.2.0, it fails, and it says it fails to load application context. Can someone help me why ...
Equiprobable asked 11/12, 2023 at 7:4

4

Solved

I have faced with issue trying to select for update row using Spring data with Hibernate as JPA implementation and Postgresql. Suppose we have entities:A,B,C. public class A{ @Id private Long i...
Mauramauralia asked 18/9, 2017 at 14:40

2

Solved

So I've been trying the solutions out there to map a ManyToMany relationship with extra columns but none of them is working for me and I don't know what am I doing wrong. The Many to Many relations...
Spacing asked 23/4, 2021 at 8:55

6

I have some problems with using a schema.sql file to create my sql schema when executing a junit test while this schema contains mysql specific expression. I have to add the mode=mysql to the H2 ur...
Bakehouse asked 21/2, 2017 at 10:36

3

I'm trying to store a java Date with milliseconds in MySQL's timestamp column using Hibernate, but the millisecods are stored always as .000. The definition of the column in hibernate is as follow...
Charissa asked 17/1, 2016 at 13:37

9

Solved

Good morning all, i'm dealing with an Ambiguous mapping i cannot decode... I'm using Spring mvc 4.0.6 and hibernate 4.3.6 I'm getting this error while launching the war in tomcat: ERROR [localhost...
Pinette asked 22/11, 2015 at 11:26

5

Solved

I'm starting with Hibernate and I have an error that I just can't figure out. I have the following Classes: @Entity @Inheritance(strategy = InheritanceType.TABLE_PER_CLASS) public abstract class ...
Principal asked 21/10, 2016 at 13:25

8

Solved

In a Spring 3 application, I'm trying to implement multi-tenancy via Hibernate 4's native MultiTenantConnectionProvider and CurrentTenantIdentifierResolver. I see that there was a problem with this...
Suspensoid asked 12/2, 2013 at 16:51

11

Solved

I have a Spring application which uses Hibernate on a PostgreSQL database. I'm trying to store files in a table of the database. It seems it stores the row with the file (I just use persist method ...
Burwell asked 2/7, 2010 at 7:59

9

Solved

I have a Spring Roo + Hibernate project which takes a JTS well-known text (WKT) String input from the client application, converts it into a JTS Geometry object, and then attempts to write it to th...
Micrometry asked 31/8, 2012 at 12:17

5

Solved

spring.jpa.properties.hibernate.dialect=org.hibernate.spatial.dialect.postgis.PostgisDialect I have a Spring Boot v1.5 application with Hibernate 5 running a Postgis database. However, I'm having...
Duncandunce asked 5/6, 2019 at 9:45

15

Solved

As JPA requires, @Entity classes should have a default (non-arg) constructor to instantiate the objects when retrieving them from the database. In Kotlin, properties are very convenient to declare...
Ornie asked 16/8, 2015 at 17:54

5

Solved

I work with Hibernate and Oracle. I used this code : if (null != sessionFactory) { Session s = currentSession.get(); if ((null == s) || !s.isOpen()) { s = sessionFactory.openSession(); curre...
Tincture asked 18/5, 2015 at 12:48

2

Solved

I have below entity with custom AttributeConverter which saves field in the DB as binary data. TaskEntity.java @Entity @Table(name = "task") public class TaskEntity { @Id @GeneratedValue @Col...
Sycophancy asked 14/11, 2017 at 12:17

7

Solved

I'm getting this error when submitting the form: org.hibernate.PersistentObjectException: detached entity passed to persist: com.project.pmet.model.Account; nested exception is javax.persistence...
Deuce asked 27/12, 2014 at 23:14

3

When I run my Spring Boot application, everything works fine: Hibernate generates tables and populates them with a LoadDatabase configuration class. I have a TestController that I use to test wheth...
Entity asked 1/5, 2023 at 6:15

7

Solved

Please help me understand where to use a regular JOIN and where a JOIN FETCH. For example, if we have these two queries FROM Employee emp JOIN emp.department dep and FROM Employee emp JOIN FETCH e...
Rheo asked 2/7, 2013 at 16:50

3

I would like to have a collection of child objects (here cat-kitten example) that are ordered. And keep their order on adding of new elements. @Entity public class Cat { @OneToMany(mappedBy = &qu...
Controvert asked 9/11, 2013 at 2:37

6

I'm trying to store the following tweet into a longtext column / utf8 charset / MySQL 5.5. database with MyISAM storage on. We also tried utf8mb4, utf16, utf32 charsets but are unable to get past ...
Phasia asked 3/1, 2012 at 9:1

3

Solved

Already read lots of questions about the same issue, but I still not be able to solve this problem. I need to have a String primary key on my database. import javax.persistence.Entity; import jav...
Reticulum asked 24/8, 2018 at 19:40

© 2022 - 2024 — McMap. All rights reserved.