Category "hibernate"

Hibernate 4 Could not obtain transaction-synchronized Session for current thread

I know it's far not a new question. For example lots of recipies can be found here both in question and replies. However, I didn't manage to solve mine. I user

change Hibernate 5 naming strategy + spring boot + annotation

My spring boot project is using JPA hibernate annotation in entity classes. I have my own generic repository and I'm NOT getting the Hibernate SessionFactory fr

The method getCurrentSession() is undefined for the type SessionFactory

I'm doing a web based project using Maven,Spring and Hibernate.I just have faced a problem. The problem is whenever I'm using sessionFactory.getCurrentSession()

how to download hibernate documentation

Hello guys I am really sorry for such question. I could not download hibernate official documentation I was using online html version. Is it possible to downloa

Difference between save and saveAndFlush in Spring data jpa

I am trying to learn spring data JPA by testing some CRUD operation via JpaRepository. I came across two methods save and saveAndFlush. I don't get the differe

Error : Cannot use identity column key generation with <union-subclass> ( TABLE_PER_CLASS )

I am using Hibernate to save entities where all entities are inherited from a base abstract entity. For all concrete Entities there are database tables respecti

Not-null property references a transient value - transient instance must be saved before current operation

I have 2 domain models and one Spring REST Controller like below: @Entity public class Customer{ @Id private Long id; @OneToOne(fetch = FetchType.EAGER) @Joi

Java Hibernate - is it possible to save the result to the database without commit, so that I can use sql / hql to verify data and rollback if needed?

I'm using Java with Hibernate. I want to: Save my data to the database Run sql to verify the result If the result is valid, then commit, otherwise rollback So,

Get org.hibernate.LazyInitializationException in spring boot integration test

I'm trying to write integration test for Spring Boot application. I have Product and GalleryImage domain model. They are in one-to-many relationship. public cl

Fundamentals.How can you use Lazy fetching in Spring+Hibernate+=Vaadin after the session closes

There is the Customer entity which has a one to many relationship to entity Address,so there is a List<Address> getAddress in Customer.Entity Address has

org.hibernate.QueryException: Not all named parameters have been set:[]

I'm getting extremely strange behavior out of JPA 2.0 I'm trying to build a query that looks likes, where employeId and empDepartment are long values passing

Error java.lang.AssertionError: expected: null<null> but was: java.lang.String<null> what does it mean?

I have this strange issue in my Junit 4.12 test code. The application uses Spring Framework 4.1.6 and Hibernate 4. When comparing two beans coming from differen

Hibernate Mapping Error: MappingException: An AnnotationConfiguration instance

I have a project with Hibernate.I tried to read the configuration file hibernate.cfg and got this error: Error creando una factoria de session.org.hibernate.M

Spring data repository not found at compile time

I am trying to use Spring data and repositories in a Spring Boot application, but I have an error when compiling the project. Here is my Entity : package fr.i

How to limit result in @Query used in Spring Data Repository

I am retrieving data by CrudRepository in Spring Data JPA. I want to filter my records those are retrieved from my custom query provided in @Query annotation. I

Hibernate mapping classes from hibernate.cfg.xml

For class mapping from hibernate.cfg.xml I use these format below: <mapping class="packageName.className1"/> <mapping class="packageName.className2"

getting Caused by: org.hibernate.QueryException: cannot dereference scalar collection element: roles

I have this class , and i'am trying to acess mobileNumbers and roles from the user table , but being lazy intialized i keep getting 'lazy intialization error. I

What is the "proper" way to cast Hibernate Query.list() to List<Type>?

I'm a newbie with Hibernate, and I'm writing a simple method to return a list of objects matching a specific filter. List<Foo> seemed a natural return typ

Initializing C3P0 connection pool takes 2 min

I can't wrap my head around why the initialization of a c3p0 connection pool takes 2 min in my Hibernate application. This is in my Hibernate.cfg.xml: <hib

When does the hibernate session gets closed

I have created the following entities. @Entity public class Student { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id;