Skip to content
Advertisement

Tag: hibernate

HTTP status 500 error, Request processing failed; nested exception is org.hibernate.exception.SQLGrammarException: could not execute statement

I keep getting SQLGrammarException error, I could not find any syntax error from my code. Here is my controller, entity, DAO and JSP file code. Maybe my form tag in addProduct.jsp is wrong, but I could not find the solution. HomeController.java ProductDAOImpl.java Top.java addProduct.jsp Answer Analysis It looks like some names used in the database context (a table name, a

A bean named ‘entityManagerFactory’ that could not be found

I’m pretty new to Hibernate/JPA. Running the application, I’m getting this error: The main class (I use @EnableJpaRepositories to let Spring find the repository in other package): My main entity class: A repository: A properties file: Maven dependencies: What should I do here? Answer I solved this adding the following dependency instead of spring-data-jpa: After that, I got this exception:

Exclude fields from Java object using Spring

I have two endpoint who use the same model class (Cars). For the searchBigList endpoint I would like to retrieve all car fields and for searchCarSmallList endpoint I would like to retrieve just 3 fields. I tried to do it with @JsonView annotation but it was not working for me. Anyone have better idea how to do it? Answer I

Hibernate: How to distinguish two uni-directional relationship and one bi-directional relationship?

in this answer, the author said: Take an example of two entities mapped without declaring a owning side: From a OO point of view this mapping defines not one bi-directional relation, but two separate uni-directional relations. 1.My first question is: Why it is not a bi-directional relation? Docs Oracle: In a bidirectional relationship, each entity has a relationship field or

DuplicateMappingException contains physical column name referred to by multiple logical column names on adding passportId to the Student entity

This code is causing the following exception on the startup I’m using H2 in-memory database. Student entity: Passport entity: Question 1: What is the reason for org.hibernate.DuplicateMappingException? Question 2: Why does adding the following annotation to passportId in the Student entity resolve the issue? PS: I know similar questions has been asked earlier but I couldn’t understand the answer for

Convert String to Money Thymeleaf

I am having a problem converting input String to money. I am creating a spring boot application with thymeleaf. I have a web page where user inputs the data and there is a particular field where he inputs the String and it needs to be converted to type joda.money as in my pojo class that field has money data type.

Advertisement