I am working with spring for a while already and in my spring boot 1.5x’s projects always dealing with the LazyInitializationException with the next configuration (more downstairs) but now I am creating a new project with spring boot 2 and the same configuration is not being recognized further than WebMvcConfigurer now replace to the deprecated WebMvcConfigurerAdapter. My configuration: But after
Tag: hibernate
What is the purpose of the Hibernate ReturningWork interface?
I am working on one JAVA + Hibernate project but currently, I saw one interface in my code (i.e. ReturningWork<Long>) which has one method called execute(java.sql.Connection). My question is what is the use of this ReturningWork interface? Answer As I explained in more details on my blog, you can use the ReturningWork and the Work interfaces to implement any logic
How to detach an entity from an EntityManager
My environment Java 7/JPA 2/Hibernate 5.1. My Scenario I’m building a Repository pattern implementation. All code is written and it all works fine when no error condition happens. However, let’s say that three entity instances are added to the repository. First and third are ok, but second lacks value for a mandatory (not null) column. A DB error will be
What is the name dialect class for mysql 10.1.21-MariaDB
in hibernate.cfg.xml i am using MariaDBDialect class when i run my code i got this errors in console Answer You should use org.hibernate.dialect.MySQLDialect, because MariaDB is 100% compatible with mysql.
When running a project “Unsatisfied dependency expressed through constructor parameter 0”
When running a project, an error occurs: UnsatisfiedDependencyException: Error creating bean with name ‘sqlServerQueryDaoImpl’ defined in file SqlServerQueryDaoImpl.class : Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type ‘javax.persistence.EntityManagerFactory’ available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {} Code Dao DaoImpl my pom.xml stacktrace Answer Well, there are
How to update only the incoming fields in a model using spring data jpa?
I am using Spring data jpa for persistence. Say, I have to update a model. This model has ‘n’ number of fields along with a primary Key. Considering above json as a representation of my model, I want to update only those fields which are incoming in the json (primary key is Id which will always be there). Is there
Can’t register an custom Entity in Spring project
Hello I have custom entity which has fields like name, description, date ant others, I created EventRepository and EventServiceImpl. Also i have a model RegisterEvent. Event entity: EventRepository: EventServiceImpl: RegisterEvent Model But when i Try to register event in my Html : I get the following error: And in the browser shows: I don’t know whats happening in the error
Storing UUID as string in mysql using JPA
I came across a blog of using UUID with Hibernate and MySql. Now the problem is, whenever I take a look at the database the ID’s will be non-readable format (binary-16). How can I store UUID as a readable format like 7feb24af-fc38-44de-bc38-04defc3804fe instead of ¡7ôáßEN¹º}ÅÑs I was using this code And the result is ¡7ôáßEN¹º}ÅÑs. But I want it as
Hibernate Criteria API join to another table only with id
I am trying to join from one table to another by using the Hibernate Criteria API. The problem is that table Contract has only salesId as defined as long (so no FK). Then I am not sure how to associate Contract with Sales. Better to explain in an example below. The schema is the following: In Contract entity I have
Error creating bean with name entityManagerFactory with Hibernate 5.2.13.Final
I was recently running a spring-boot application with no trouble until the hibernate-core dependency came to version 5.2.13.Final. It is strange and the difference with other question with a similar title is that if I just overwrite the version of hibernate-core dependency back to 5.2.12.Final, things will be right. So I just wondering the reason why version 5.2.13.Final goes wrong,