Questions tagged [hbm]

A Hibernate (and NHibernate) feature that allows for both HQL and SQL queries to be stored in a file

A Hibernate (and NHibernate) feature that allows for both HQL and SQL queries to be stored in a file ending with *.hbm.xml. The main advantage is that your query is precompiled when the application starts up, and any errors in the query can be caught ahead of runtime.

165 questions
0
votes
1 answer

Joining Tables with Composite Primary Keys in Hibernate hbm files

I have two table to be joined using hbm file. The scenario is as follows Table B has a composite PK. Table B a1 (pk) a2 (pk) a3 (pk) foo bar ======== Table A has a primary key and is a foreign key from Table B Table A a1 (pk,fk) hip …
ajithparamban
  • 2,833
  • 3
  • 17
  • 14
0
votes
2 answers

NHibernate one-to-many not saving children

class A {..} class ContainedA { property of type A and some extra information } class B : A { collection of type ContainedA } As you can tell the idea is to be able to contain a single instance of A in several B's, B itself is also of type A only…
DorD
  • 153
  • 2
  • 12
0
votes
0 answers

Hibernate 6 migration and dynamic-component or dynamic fields

I migrate a Spring 5/Hibernate 5 application to Jakarta EE and have an issue with the Hibernate 6 migration. Since Hibernate 4 I used the hbm.xml and the for adding custom fields to entities at the start of the application. With…
user3612610
  • 233
  • 4
  • 18
0
votes
0 answers

hibernate composite-id returns null results

Just before anyone down rate this question, I want to say i have tried to search an answer for this problem for 2 days now without any answers. I have tried a lot but could not resolve it so posting it here. I have created a view in mysql DB. Using…
Abdus Samad
  • 343
  • 2
  • 12
  • 27
0
votes
1 answer

LazyInitializationException: could not initialize proxy - no Session lazy proxy, false fetch join?

I have a case where I get LazyInitialzationException in my project. It happens on here: if (study.getIbId().equals(actor.getRepository().getIbId())) { actor variable is type of Account and Repository is type of Repository. Ibid is Long type.…
Jonathan Hagen
  • 580
  • 1
  • 6
  • 29
0
votes
1 answer

nhibernate map sql stored procedure to entity

Edited: I found another solution to call stored procedure via NHibernate and map it on my entity: var campaignsItems = nhSession.CreateSQLQuery("exec Select_List_Campaigns :currentLatDegrees, :currentLonDegrees, :radiusInMiles, :pageSize,…
Ang
  • 35
  • 2
  • 3
  • 8
0
votes
1 answer

NHibernate enable lazy loading for single query

In .hbm mapping file, i have the following setting: /.../ The lazy loading for this collection is globally disabled Is it a way to "locally" enable lazy loading only…
0
votes
1 answer

Mapping an object in Hibernate that has 2 lists causing problems

I'm trying to save an object that has 2 similar lists using a hbm.xml file. Below is my model object and HBM: public class MyClass { ... private List list; private List otherList; ... } My HMB for this section is as…
thedude19
  • 2,643
  • 5
  • 34
  • 43
0
votes
1 answer

Recursive HBM Mapping

Can I do the following in my HBM mapping? When I…
David
  • 299
  • 2
  • 6
  • 16
0
votes
1 answer

How can we represent in Hibernate (HBM) a lazy many-to-one relationship while allowing the same class to be referenced in eager mode?

I am trying to make some of my many-to-one relationships in my hibernate HBM files lazy. Concretely I have a DataElement class that references the Filter element in a many-to-one relation, I want to make it lazy while keeping access to Filter eager…
jemailix
  • 75
  • 6
0
votes
2 answers

Replacement for DirectPropertyAccessor?

I am upgrading a Spring 4.3.2 project to Spring 5.1.5. One of my test cases started failing with the error. ClassNotFoundException: org.hibernate.property.DirectPropertyAccessor Which makes sense since it has been deprecated in Hibernate 5.x which…
Vivek Shankar
  • 770
  • 1
  • 15
  • 37
0
votes
1 answer

Reference an object from a column in another table

I have the following object model: class ObjectA{ public string Description {get;set;} } class ObjectB{ public string Description {get;set;} public ObjectA A {get;set;} } class ObjectC{ public string Description {get;set;} …
brainimus
  • 10,586
  • 12
  • 42
  • 64
0
votes
1 answer

Hibernate unable to FETCH child entitiy

I have two entities namely Student and Address. The parent Entity being Student and the Child entity being Address. Considering that each student can have only one Address and each Address can belong to only one student,and declaring the Address…
RRV
  • 51
  • 8
0
votes
1 answer

Want Order by in descending order through hibernate hbm xml mapping

My hibernate hbm xml has an attribute mapping as
Ayush
  • 206
  • 7
  • 22
0
votes
1 answer

Need help with HQL query

I have a simple class, called Person, as follows: public class Person { private Integer id; private String name; private List states; ... } And each PersonState is defined like: public class PersonState { private…
Joaquín L. Robles
  • 6,261
  • 10
  • 66
  • 96