Questions tagged [hibernate-mapping]

Hibernate uses mapping metadata to find out how to load and store objects of the persistent class. The Hibernate mapping could be specified using configuration files or annotations.

Hibernate uses mapping metadata to find out how to load and store objects of the persistent class. The Hibernate mapping could be specified using configuration files or annotations.

This tag should be used for questions regarding issues with the definition of Hibernate mappings.

3217 questions
6
votes
2 answers

New XSD schema in Hibernate 4

In Hibernate 4 I've found (new for me) possibility to use XSD schema instead of DTD.
smg
  • 173
  • 1
  • 8
6
votes
1 answer

org.hibernate.DuplicateMappingException: Table contains physical column name [coverage_name] referred to by multiple physical column names:

I am using below class but giving the exception like Caused by: org.hibernate.DuplicateMappingException: Table [] contains physical column name [scheme_name] referred to by multiple physical column names: [SCHEME], [schemeName] help me to solve this…
Roshini
  • 85
  • 1
  • 8
6
votes
2 answers

How To Use Sequence In Hibernate As A Property In XML Mapping

How do I use a sequence in Hibernate XML mappings? The documentation mentions the element. However, I want the sequence to be a column instead of an ID.
grassbl8d
  • 2,089
  • 4
  • 24
  • 34
6
votes
1 answer

How to store only specific timestamp columns in UTC in hibernate

In my Mysql DB, I have some columns which need to be stored in UTC using hibernate. I can't force my JVM to store all timestamp column in UTC as I have other columns for different time zones. I have found two solutions 1) To configure hostname as…
Himanshu
  • 706
  • 6
  • 27
6
votes
6 answers

how to Fix spring boot one to many bidirectional infinity loop?

i am try to create a one to many bidirectional mapping using spring boot and spring data jpa please look the below entity Employer Entity @Entity public class Employer { private Long id; private String employerName; private…
6
votes
2 answers

remove collection with delete-orphan not work with null assignment? :(

I am having problems removing another entity through cascade delete-orphan. It works when I clear the associated set collection, but not when I make the set collection null. Let me explain in detail. The config snippet:
edbras
  • 4,145
  • 9
  • 41
  • 78
6
votes
2 answers

JPA Hibernate Dynamic entity mapping & persistence at runtime

Basically we have a spring boot application that requires that the user can define his/her own set of fields and that these fields should be persisted in their own class/table through JPA/Hibernate at runtime. These classes will be generated…
6
votes
3 answers

How to manage version history for Many-To-Many relationship using deltas in Hibernate?

We are working on a system where a person can send a document to another person, a document can have multiple attachments, as given below. Document { Set attachments; } If X sends a document (Doc1,Ver1) to Y and Y edits the…
6
votes
2 answers

Hibernate cascade remove ConstraintViolationException

It seems the situation is simply (but it does not work). Db part (EVENT_ID is foreign key. FK_RR_E_CI constraint references on EVENT table) |-------| |----------------| | EVENT | 1 ------ ∞ | RECURRENT_RULE | |-------| …
Sergii
  • 7,044
  • 14
  • 58
  • 116
6
votes
5 answers

Java Hibernate Mapping Exception! (Could not determine type for: java.util.Map)

I have made a class with name of Movie with folowing fields: @Id @GeneratedValue private Long id; private String name; @ElementCollection(targetClass = String.class) private Map properties; private Double rate; private Integer…
Ehphan
  • 537
  • 3
  • 7
  • 19
6
votes
1 answer

Hibernate Performance issue

I am very new to Hibernate. Here I would like to compare two option. First option My hibernate pojo classes as follows. Stock { @Id @GeneratedValue(strategy = GenerationType.AUTO) @Column(name = "stock_id") private Long stockId; …
Alex
  • 790
  • 1
  • 7
  • 22
6
votes
5 answers

Hibernate many-to-many remove relation

I have an issue with an hibernate many-to-many relation: when I remove one item from my set, it is not removed in my database. I know there are tons of similar issues, but I did not succeed in fixing mine by reading them. I have written a JUnit test…
Asterius
  • 2,180
  • 2
  • 19
  • 27
6
votes
3 answers

@OrderBy causes java.lang.ClassCastException: antlr.CommonToken cannot be cast to antlr.Token

I'm trying to use the @OrderBy annotation on a Spring MVC project that run on a JBoss EAP 6.1+ server. I have 2 projects: the first one is named model-gen-wifipnsd and it contains only the model classes that are used by the second project (named…
AndreaNobili
  • 40,955
  • 107
  • 324
  • 596
6
votes
1 answer

Annotation for all-delete-orphan in hibernate 4.1.4

I'm new to this hibernate annotation. I want to convert this xml mapping into annotations:
6
votes
2 answers

Hibernate keeping inactive session in oracle db even after closing the session

In my hibernate application I have written below code for saving EmployeeRegistration object into oracle db. public Integer submitDetails(EmployeeRegistration es) { Session session = factory.openSession(); Transaction tx = null; Integer…
Badal
  • 376
  • 4
  • 11