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

How to specify a field, so that when we query, using Joda LocalDate or LocalDateTime value for the field, it is mapped to same column?

I have a postgres database that has a table "draft" containing a column set_up_time, saved as a timestamp: @Column(nullable = false) @Type(type = "org.jadira.usertype.dateandtime.joda.PersistentLocalDateTime") LocalDateTime setUpTime; For certain…
neoInfinite
  • 341
  • 2
  • 4
  • 12
1
vote
1 answer

Generating Hibernate Mapping Files and POJOs from Database with netbeans

I just reinstalled everything on my computer and had to setup Netbeans again. I've opened a hibernate project and I've just added 3 new tables to the database. I've attempted to map these files by using "Hibernate Mapping Files and POJOs from…
CaptainMorgan
  • 1,193
  • 2
  • 25
  • 55
1
vote
2 answers

hql inner join Path expected for join! error

hi have following entities; @Entity public class FilesInfo { @Id @GeneratedValue private Integer id; private String name; private String url; @OneToMany(cascade= CascadeType.ALL) @JoinColumn(name="fileId") private…
Aadam
  • 1,521
  • 9
  • 30
  • 60
1
vote
1 answer

Spring request bind and hibernate presist

For Spring MVC application as ORM jpa with hibernate was configured. Every request will be in usual form submit and response will be json so configured Jackson Json and used @ResponseBody . Everything was working fine except one Many to One mapping…
arvindwill
  • 1,960
  • 1
  • 23
  • 39
1
vote
0 answers

Hibernate mapping throws class not found exception

I've been trying to start up Tapestry with Hibernate through SQL Server 2008. I followed the tapestry and hibernate guide at the start, but when I got to the mapping part, I got this class not found exception, that further throws could not parse…
zoran.m
  • 11
  • 1
1
vote
0 answers

How to add an int array Default Value for a FluentNHibernate mapping

Recently, I added a new column to my UserMap class, to add an int array public class UserMap : ClassMap { public UserMap() { Table("user"); LazyLoad(); Id(x => x.Id).GeneratedBy.Identity().Column("Id"); …
1
vote
0 answers

Join two table on part of composite key in hibernate mapping

I have two tables as follows: Table A: site [pk] group [pk] Table B: group [pk] method[pk] gate [pk] Composite key for A - [site-group]. Composite key for B - [group-method-gate]. How to Retrieve all records of A's table…
Piyush Aghera
  • 965
  • 7
  • 13
1
vote
2 answers

Hibernate: composite-id with key-many-to-one generating java.lang.stackoverflow error

I've been trying to map the following tables into Hibernate with hbm files: CREATE TABLE additional_info ( info_id SMALLINT, book_id INT, desc VARCHAR(32) NULL, CONSTRAINT additional_info_pk PRIMARY KEY…
user2170297
  • 11
  • 1
  • 4
1
vote
0 answers

Hibernate inserting NULL values for combiner foreign keys

I have the following table structures. Region table { `RegionId` int(11) NOT NULL AUTO_INCREMENT, `RegionName` varchar(45) DEFAULT NULL, PRIMARY KEY (`RegionId`) } Client table { `RegionId` int(11) NOT NULL, `ClientName` varchar(45) NOT…
Murali D
  • 448
  • 1
  • 4
  • 18
1
vote
1 answer

hibernate: one-to-many not loading all entities but only one

I am relatively new and trying to load child entities using one-to-many mappings. But, during initializing process, I see only one entity being loaded. The child table associated has 3 more rows which are not loaded though I see the query getting 4…
ron0102
  • 13
  • 4
1
vote
2 answers

Difference between EntityManagerFactory and SessionFactory?

I am new to Hibernate and JPA .Right now I am using EntityManagerFactory Instance to create EntityManager then I have UnWrap this EntityManager into Session using entityManager = entityManagerFactory.createEntityManager(); session =…
user1679378
  • 1,370
  • 3
  • 17
  • 23
1
vote
1 answer

How to update child when parent is deleted

my requirement is when i delete the parent ,child should not be deleted but instead of deleting child,one of the child column department_ID which is foreign key must be update with some value , say one department(Parent Table) contains many employee…
henrycharles
  • 1,019
  • 6
  • 28
  • 66
1
vote
0 answers

Mapping a table with only foreign keys in hibernate

I am new to hibernate and i want to map a table having only foreign keys using xml file. I have 3 tables 1.UserInfo(for user details with a primary key) 2.AuthorInfo(containing author details with a primary key) 3.AuthorFollow(to map which user is…
Ashish Tanna
  • 645
  • 1
  • 10
  • 25
1
vote
3 answers

Unknown column username in 'where clause'

I got this error when I try to select on table that one of its column is foreign key: select count(*) from cards where username = 'name'; I am doing it through java jdbc so I think something with my mapping is wrong because the same query on…
user1692261
  • 1,197
  • 3
  • 16
  • 30