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
1
vote
1 answer

Conditional Join in Hibernate

Here is what I am doing: Their is table MEDIA against this their are multiple entries in MEDIA_TAGS table. So based on some user input for media tags I have to fetch the MEDIA table records. So here I have to join the tables MEDIA and MEDIA_TAGS…
1
vote
1 answer

Query many to many relationship with DetachedCriteria

Right now I have 3 tables in database: Table A: id: ... Table B: id: ... Table C: A_id: B_id: ... The mapped object is like this: @Entity @Table(name="A") Class A{ Long id; @ManyToMany @Fetch(FetchMode.SELECT) …
user2440712
  • 719
  • 2
  • 9
  • 16
1
vote
1 answer

Create index on field from parent class

I have problem with adding index. I use hibernate with annotation driven configuration. I have something like this: @MappedSuperclass public abstract class BaseEntity { @Id private String id; private String profileId; ... //getters…
Dmitry
  • 127
  • 6
1
vote
2 answers

My hibernate code to retrieve records does not work

I am using the following code to retrieve all the records that their time column is passed but it does not show anything. Criteria cre = session.createCriteria(Timing.class, "timing") …
Tim Norman
  • 421
  • 1
  • 12
  • 31
1
vote
0 answers

org.hibernate.hql.ast.QuerySyntaxException: entity class is not mapped

I'm trying to fetch object from a mapper table by hibernate createQuery, but I am getting this error. ERROR details 2013-08-14 15:33:44 DEBUG DispatcherServlet:671 - Could not complete request org.hibernate.hql.ast.QuerySyntaxException:…
abhishek
  • 51
  • 2
  • 11
1
vote
2 answers

How to avoid duplicate records when update in DB using hibernate

I am updating the record with multiple entries in the db at a time.when i try to create another multiple records, duplicate entries are saved in DB.how to prevent records from duplicates entry using hibernate.i want to restrict 2 or more column…
Haseena
  • 53
  • 1
  • 7
1
vote
1 answer

one to one hibernate mapping

i have done one to one mapping in hibernate 3 with annotation, i have tow tables 'group' and 'category' . categories are predefined. when user choose category and group ,CategoryId and goupid should insert in group table only. So how should to…
Dinesh Maske
  • 199
  • 1
  • 1
  • 11
1
vote
0 answers

How to debug coldfusion orm settings and mappings

I'm having trouble with a specific ORM cfclocation not being mapped correctly. Coldfusion is checking in the cfclocation I have provided and then cacheing the mapping in a different location so that when I try to load the entity it can't find the…
Rumpleteaser
  • 4,142
  • 6
  • 39
  • 52
1
vote
2 answers

How to Segregate comman fields in Hibernate annotaion mapping

I am using spring 3 and hibernate4.2 based annotation configuration in my project, I have number of database tables (view objects/entities) with two common fields createdDate & updatedDate. I want to segregate these two fields. I thought of keeping…
Vikram
  • 11
  • 1
1
vote
0 answers

Hibernate Collection mapping, Refactoring

The title may not be very descriptive. I have recently come across a problem with Hibernate many-to-many collections using Link tables. In the application we were using List and whenever we delete or insert an entry from the collection, hibernate…
uncaught_exceptions
  • 21,712
  • 4
  • 41
  • 48
1
vote
1 answer

Combining xml and java configurations in spring 3.2 + hibernate 4

I get the following error when i try to manipulate the person 'entity' from within the spring container: Exception in thread "main" org.hibernate.MappingException: Unknown entity: org.s pring.entity.Person at…
IUnknown
  • 9,301
  • 15
  • 50
  • 76
1
vote
1 answer

How would I map this existing DB in Grails?

We have an existing Oracle database and I would like to map it in Grails 2.2.3 so I can use it with GORM. I have an Authorization table that has primary keys in it for several entities such as Fund, Organization, Account, etc. Here is what the table…
grantmcconnaughey
  • 10,130
  • 10
  • 37
  • 66
1
vote
2 answers

Hibernate many-to-many data retrieval, via query

Please help me, I think there is something that I am not doing correct. I have User and Contact, that are in Many-to-Many relation. User.java: public class User { private Integer userID; private String userLoginEmail; private…
Harbir
  • 453
  • 1
  • 7
  • 24
1
vote
0 answers

Hibernate cannot simultaneously fetch multiple bags two Lists

I have very strange situation. Before when I tried to fetch multiple collections by one try of HQL query I have not had this error. The Internet says that the problem can occur because of FetchType.LAZY, but I removed it and nothing change. My…
i'm a user
  • 67
  • 1
  • 4
  • 10
1
vote
0 answers

Hibernate - mapping two parent table to one child table

I am facing a small problem in creating hibernate mapping files for below sort: Table A |-- Table B | | |-- Table C Table B has a column from Table A as foreign key Table C has a column from Table A and a column from Table B, both as foreign…
Sam
  • 11
  • 3