Questions tagged [hbmxml]

Questions related to hbm.xml files used by the Hibernate ORM to define mappings, as opposed to the more modern mapping strategy using annotations.

72 questions
54
votes
2 answers

How can I map "insert='false' update='false'" on a composite-id key-property which is also used in a one-to-many FK?

I am working on a legacy code base with an existing DB schema. The existing code uses SQL and PL/SQL to execute queries on the DB. We have been tasked with making a small part of the project database-engine agnostic (at first, change everything…
Jesse Webb
  • 43,135
  • 27
  • 106
  • 143
9
votes
1 answer

How to generate hbm.xml file from FluentNHibernate

I'm trying to follow this tutorial but instead of generating the expected hbm.xml files with my mappings in it generates simple .cs class for my entities like for example: public class ProductMap : ClassMap But I already defined those…
Kris van der Mast
  • 16,343
  • 8
  • 39
  • 61
9
votes
2 answers

Avoid "Hibernate exception Null value was assigned to a property of primitive type setter" without wrappers

Having a long field on an entity managed by hibernate could be dangerous with null values. When Hibernate tries to set a null into a primitive an exception will be thrown. Best solution should be to use Long instead of long, so null can be assigned…
Ignasi
  • 5,887
  • 7
  • 45
  • 81
7
votes
1 answer

To map a database view with no primary key, in hibernate xml mapping

I have created a view which will be used for fetching the data only(readonly) View : Grid_View > My Hibernate hbm file
Dev
  • 3,922
  • 3
  • 24
  • 44
5
votes
1 answer

Hibernate TransientPropertyValueException When saving data

I am trying to insert data to the DB using hibernate . Here is how I going perform that action session.beginTransaction(); pojo.StuDetails stu = new StuDetails(); stu.setFName(f_name); stu.setLName(l_name); stu.setSex(sex); …
Steve Silva
  • 85
  • 1
  • 1
  • 6
5
votes
3 answers

org.hibernate.MappingException: Unknown entity: pack1.Persoana

I receive this error and I don't know what is wrong with my hbm.xml file. I use Eclipse Mars and Hibernate 5.0.2. Error: Nov 15, 2015 11:49:19 PM org.hibernate.Version logVersion INFO: HHH000412: Hibernate Core {5.0.2.Final} Nov 15, 2015 11:49:19 PM…
Ștefan Blaga
  • 404
  • 1
  • 5
  • 22
4
votes
2 answers

Hibernate Mapping same Column twice

How can fix this thing Repeated column in mapping for entity: com.abc.domain.PersonConnect column: PERSON_ID (should be mapped with insert="false" update="false") this is snippet from my hbm file
Pradeep Kumar
  • 79
  • 1
  • 10
4
votes
2 answers

Hibernate 4: One class mapping Two tables - How to persist one object on both tables?

I have this class Person mapping two tables: Persons and PersonsAUD (audit):
vladiastudillo
  • 407
  • 1
  • 10
  • 23
3
votes
2 answers

Hibernate @ManyToOne and @OneToMany fetch data as List(num of records)

I have 2 tables 1.Org[ORG_ID,PARENT_ID,LANG_ID(REFERENCES LANG)] 2.Lang[LANG_ID,LANG_NAME] My JAVA Entity Files Lang.java @Entity @JsonIdentityInfo(generator = ObjectIdGenerators.PropertyGenerator.class, property = "langId") @JsonIgnoreProperties({…
2
votes
1 answer

Get user data between two date in Hibernate Java

i have an hibernate entity called user.I want to get the list of users who are between two dates a date interval. Example, I have a date D1 and I want to know the people hired between my hiDate and my depDate. Here is the mapping of the hibernate…
ln3106
  • 113
  • 10
2
votes
2 answers

Insert records in multiple tables with same ID with Nhibernate hbm mapping

I have two tables, Table 1 has a identity column(AttachmentID) and other fields, Table 2 has a AttachmentID column which is FK of Table1.AttachmentID and PK(not identity column), so Table1.AttachmentID = Table2.AttachmentID, records may or may not…
Sumit Bansal
  • 63
  • 10
2
votes
0 answers

How to setup a hibernate hbm xml identity generator for DB2 "GENERATED BY DEFAULT WITH SPECIFIER"

I got a hbm mapping for a column, that is set to identity generator ... and half of it already…
Markus
  • 357
  • 2
  • 13
2
votes
2 answers

Unidirection OnetoOne mapping foreign primary key is not generating in child table

I have one parent table CUSTOMER_ACCOUNT and one child table CUSTOMER_TEMPINFO. I'm trying to generate the primary key in parent table and assign the same in child table. I've to use the unidirectional way, so bidirectional solution please…
Rup Majumder
  • 241
  • 3
  • 6
  • 13
2
votes
2 answers

Using a named query in a hbm with import class

In my MSSQL server I have a SQL view called AllFavourite. In order to load the data into my DTO class I have the following in my hbm.xml file...
Rippo
  • 22,117
  • 14
  • 78
  • 117
2
votes
0 answers

nhibernate - hbm xml - complicated property ref attribute

I using nhibernate with hbm files (not fluent). In the mapping hbm file, I need to use the attribute property-ref but not in the simple way. I need to access to an inner proprty of an object. I need to use it like…
Nuriel Zrubavely
  • 463
  • 3
  • 13
1
2 3 4 5