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
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
1
vote
0 answers

(Hibernate )how to convert hbm files to JPA annotation based classes?

Can any one tell me how to convert .hbm files to annotated based classes . I was trained in annotation based hibernate but in project they were using hbm files .Its really hard to understand . I really appreciate if any one share some tutorial on…
1
vote
2 answers

Liquibase-maven plugin doesn't detect change between Hibernate hbm.xml and changelog.xml

I recently started on a project that utilizes MySQL database with Maven, Hibernate, and Liquibase, and I am not at all experienced in any of these so please forgive my naivety. My goal for right now is trying to produce a diff changelog which I…
user2475343
  • 11
  • 1
  • 4
1
vote
1 answer

Another NHibernate Mapping Mystery! Getting count in hbm file

I am trying to retrieve the count of items allocated to a container in my hbm file. I've done a bit of digging and managed to get my hbm code this far (below!). I want the count to be retrieved every time a container object is queried. I could use…
maxxxxxim
  • 11
  • 2
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
1 answer

update a property of many-to-many

I'm having a many-to-many association between tables Student and Course, that are connected through StudentCourse. StudentCourse has an extra property called grade. In order to have access from a student to his grades for a particular course, I…
sgrossman
  • 105
  • 2
  • 7
1
vote
1 answer

Mapping inherited class with nhibernate hbm

I Have 2 classes of the same table. one class, "Entity", contains properties x,y,z from table ENTITY and the derived class, "ExtendedEntity" contains some more properties (collections - relations to other tables). I want to map both of them but i…
1
vote
1 answer

Hibernate: shuffling child nodes in a bidirectional ordered tree

I have a basic tree structure composed of a simple Node class, linking bidirectionally to it's single parent (can be null for root nodes) and an ordered list of children: public class Node { private Integer xid; private Node parent; …
Laurent Grégoire
  • 4,006
  • 29
  • 52
1
vote
1 answer

Transform .HBM model to annotated pojos

We have our domain model declared in rusty old hbm files, we wish to move to POJOs annotated with the javax.persistence.* annotations. Has anyone had experience doing so? Are there tools that we could employ?
chickeninabiscuit
  • 9,061
  • 12
  • 50
  • 56
1
vote
1 answer

Hibernate hbm many to many mapping

I am trying to create a one-to-many mapping between 2 objects (work with Java). I am able to save the objects in the database, but not their relationship. I have a class called "AuthorizationPrincipal" and it contains a set of "Privileges"
szrrizvi
  • 135
  • 1
  • 1
  • 9
1
vote
1 answer

Hibernate: Using complex classes as properties

I am trying to do the following: public class Distance { private Course courseA, courseB; private int minDistance; double cost; private Long id; public Distance() { super(); } public Distance(Course courseA, Course courseB, int…
Yonatan K
  • 600
  • 1
  • 5
  • 12
0
votes
2 answers

Session and get method in hibernate

I have the following project and its returning "null" .. How to resolve it? My java class : public class UpdateExample { /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method…
Smitha
  • 6,110
  • 24
  • 90
  • 161
0
votes
1 answer

subclass or Inheritance which way is best using hibernate hbm?

Can someone share me the better approach for this below question using hibernate hbm files? Let's say I have 2 classes called Vehicle, Car and 2 tables Vehicles and Car. Vehicles having generic fields which suppose to have for every Car, Bus, etc. I…
gubs
  • 439
  • 3
  • 11
0
votes
2 answers

Hibernate findByexample Issue

I have two table User and Address Table And their relation in HBM is So when I set Address Pojo…
AliMan
  • 107
  • 2
  • 2
  • 10
0
votes
1 answer

Hibernate: optional many-to-one with not-null columns

I've got an optional many-to-one relationship between two classes. Hibernate translates the property to be optional by setting the foreign keys to null. My db-schema does not allow the columns to be null. The property to be optional is represented…
thomas
  • 5,637
  • 2
  • 24
  • 35