Skip to content
Advertisement

Tag: hibernate-mapping

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

Hibernate: mapping with a map and getting argument type mismatch

I’ve got this class DepartmentPerson in Java where I’ve mapped a Map in Hibernate as following: and in the class I have acceptByPeriod defined as following: Whenever I run a query on DepartmentPerson, I get the message: “java.lang.IllegalArgumentException: argument type mismatch”. This has something to do with the acceptByPeriod mapping, as when I remove it the problem disappears. All 3

Non-Redundant Hibernate List-Mapping (OneToMany)

In a database there are “pastries”. A pastry has zero, one, or many allergens. Hence I’m using a list in Pastry with @OneToMany relation. Now, with this way of managing the relations, we get redundant entries, as for each pastry a new entry with the same allergen is created: Our current solution looks like this: A mapping-table in between those

JPA SQL Result Mapping

my code is mapping query result to DTO using Sql Result Mapping and create list with these dtos but in my database id can be null and it gives me trouble in mapping. That’s why I don’t want to use it instead of that, is there any way to generate id’s for these dto’s not getting them from sql query?

“Illegal attempt to map a non collection as a @OneToMany, @ManyToMany or @CollectionOfElements”

Good morning Stackoverflow, I have the problem that it gives me the error: Failed to create sessionFactory object.org.hibernate.AnnotationException: Illegal attempt to map a non collection as a @OneToMany, @ManyToMany or @CollectionOfElements: nl.scalda.pasimo.model.employeemanagement.EducationTeam.coachGroups Do you know why? Answer The Exception is straightforward and says : Illegal attempt to map a non collection as a @OneToMany, @ManyToMany or @CollectionOfElements, so the cause

Hibernate: New Session without dropping the tables

I am new to Hibernate (implementing since yesterday) and i succesfully created a method, that transfers my Customer Objects to the Database. After i quit my application and start it again and create a new session (in an other method) based on my hibernate.cfg.xml file with this setting: It leads to that point, that all relevant tables, created with Hibernate

Advertisement