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
5
votes
1 answer

Hibernate - How to disable mapping for a column

When tagged as @Entity, each attribute of a class is mapped to one database column. I have some classes where I want to add some fields for internal usage, but I don't want them to be mapped by hibernate to a database column. Is there a way to do…
Ticker23
  • 172
  • 4
  • 19
5
votes
2 answers

how , where and when to use natural-id in hbm file in hibernate?

I searched a lot in google but i didn't find any satisfied answer. So any one any please tell me a senario, where to use natural-id in hbm file in hibernate. Any help would be greatly appreciated. Thanks in advance.....
user671032
  • 51
  • 1
  • 3
5
votes
1 answer

How to set up "one-to-many" mapping of List objects by XML without index column

I can set up "one-to-many" mapping of List objects by using annotations, however using XML is not. Could you tell me how to set up using XML mapping. Any help will be appreciated. Question. Do I need "INDEX" column when I associate some List objects…
zono
  • 8,366
  • 21
  • 75
  • 113
5
votes
2 answers

Mapping POJO to Entities

In our project we have a constraint of not having the luxury to alter the table structure already in place. The tables are highly denormalized in nature. We have come up with good POJOs for the application. We have the Entity beans generated out of…
Sripaul
  • 2,227
  • 9
  • 36
  • 60
5
votes
1 answer

Are positional parameters deprecated in Hibernate 5.3.2?

We are migratiing from Hibernate 3 to Hibernate 5.3 ,We have used positional parameters in HQL, I see some posts on Hibernate support saying that positional parameters are no longer supported in Hibernate 5. And should be replaced with named…
5
votes
1 answer

Hibernate Filter Programmatically

How to programmatically achieve the same result (as the following annotation would achieve)? Or injecting the value 'SMITH' in a spring configuration file? @Filter(name="smithFilter", condition="LAST_NAME = 'SMITH'") public String getLastName() { …
5
votes
0 answers

JPA autogenerate composite key based on another key

Address table have following structure with composite keys, user_id is foreign key as well a part of composite PK : address_ordinal(PK) user_id(PK, FK) 1 1 2 1 1 2 …
codeworks elegant
  • 1,051
  • 7
  • 11
5
votes
1 answer

Spring Data JPA Could not instantiate persister org.hibernate.persister.entity.JoinedSubclassEntityPersister

I faced a problem using @Inheritance(strategy = InheritanceType.JOINED), i have four classes envolved in this problem, Person (Superclass) , Supplier(child class), Client (child class), Transaction ( have a relathion with Client and Supplier…
abdou amer
  • 819
  • 2
  • 16
  • 43
5
votes
0 answers

is it possible to skip hbm2ddl hibernate validation for en specific entity and column

I am using to validate the java project against the database. But I want to skip the validation for specidc entity column, since they have wrong mapping but I don't want to change those in…
Yashar
  • 1,122
  • 2
  • 15
  • 43
5
votes
2 answers

Why does Hibernate 5 sequence generator use the default hibernate.seq instead of my sequence?

Aftre migrate my application from hibernate 4 to hibernate 5 .my sequence dose not work and hibernate use our default sequence instead of my sequence .my mapping config in hbm like this my database is oracle .
ali akbar azizkhani
  • 2,213
  • 5
  • 31
  • 48
5
votes
2 answers

hbm2ddl.auto is set to "UPDATE", but its trying to create table before every insertion

Correct me if i am wrong!. Generally, if hbm2ddl.auto is set to "UPDATE", hibernate checks if the table exists in db or not, if not it creates that table and pushes the data, if table exists it just adds data to that table. for hbm2ddl.auto =…
lovelyim92
  • 141
  • 2
  • 9
5
votes
2 answers

Hibernate auto-increment property

I know you can auto-increment an id by mapping; But is it also possible increment a property, what I tried so far didn't work;
Thizzer
  • 16,153
  • 28
  • 98
  • 139
5
votes
1 answer

Hibernate/JPA: storing constants in entity class?

I work on remote project and found interesting record in log: 2015-12-26 00:28:30,835 DEBUG org.hibernate.tool.hbm2ddl.SchemaUpdate Caller+0 at org.hibernate.tool.hbm2ddl.SchemaUpdate.execute(SchemaUpdate.java:251) => alter table bail add…
gavenkoa
  • 45,285
  • 19
  • 251
  • 303
5
votes
0 answers

hibernate dynamic component equivalent annotation

What is the equivalent way of defining dynamic component in hibernate by annotations? public abstract class CustomizableEntity { private Map customProperties; public Map getCustomProperties() { if (customProperties == null) …
Morteza Malvandi
  • 1,656
  • 7
  • 30
  • 73
5
votes
1 answer

Hibernate inheritance and 2nd level cache proxies

Simple app works wrong with following entity structure @Entity(name="some_table") @Inheritance(strategy= InheritanceType.SINGLE_TABLE) @DiscriminatorColumn( name="TYPE", discriminatorType=DiscriminatorType.STRING ) abstract class EntityBase { …
demon101
  • 544
  • 1
  • 11
  • 39