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
2 answers

Retrieving a value from Stored Procedure using Native SQL Hibernate

Below is the stored procedure: create or replace procedure proc_emp_name(v_emp out emp.emp_name%TYPE, v_empid in emp.emp_id%TYPE) is begin select emp_name into v_emp from emp where emp_id = v_empid; dbms_output.put_line('Emp Name: ' ||…
user182944
  • 7,897
  • 33
  • 108
  • 174
1
vote
2 answers

Hibernate mapping with one-to-many polymorphic relationship

I have the following class diagram and I want to map it to a database (note that Person has a list with objects of class Vehicle). Also my database looks like: All tables in the database that represent a subclass of the Vehicle class have all the…
Soc
  • 283
  • 3
  • 17
1
vote
1 answer

OneToMany association updates instead of insert

I have an entity with one-to-many association to child entity. The child entity has 2 columns as PK and one of the column is FK to the parent table. mapping looks like this: @OneToMany(cascade = {CascadeType.ALL}, fetch = FetchType.EAGER )…
Shvalb
  • 1,835
  • 2
  • 30
  • 60
1
vote
1 answer

if it's possible to configure hibernate to ignore missing resources in hibernate.cfg.xml file?

I have some test tables mappings in my hibernate.cfg.xml file, for example: If this resource isn't exist in class path then my schema creation process will fail, there is any way to configure…
Maxim Kirilov
  • 2,639
  • 24
  • 49
1
vote
1 answer

Using addJoin in Native SQL Hibernate

I am using Hibernate 3.2.5 for my application. I have a Dept table and an Employees table. Dept.java private int deptId; private String deptName; private Map empMap = new HashMap(); //Getters and Setters Employees.java private int empId; private…
user182944
  • 7,897
  • 33
  • 108
  • 174
1
vote
1 answer

Hibernate does not show the results of a select on ManyToOne relationship

I have two tables which have ManyToOne relationship. I need to shows specific rows of my ManyToOne relationship, but nothing will be shown in neither the page nor the console. (It does not even show the generated SQL although Hibernate shows the…
user2071377
1
vote
1 answer

How to add mapping resource to hibernate configuration programatically for session factory creation?

I am trying to create schema dynamically using hibernate / Java/ GWT, I am creating cfg.xml and hbm.xml files dynamically and storing it in database as blob. So I want to build sessionfactory for the schema. For the same I am creating…
1
vote
1 answer

Mapping exception says, could not instantiate id generator. Why this exception?

While trying to achieve one to many mapping for class Person and Address I get the following exception :org.hibernate.MappingException: could not instantiate id generator. I don't know the reason for this. What could be the reason I am getting this…
Suhail Gupta
  • 22,386
  • 64
  • 200
  • 328
1
vote
1 answer

Unable to make 'many-to-many' relation between Person and Address class

How do I make many-to-many relation between 2 classes Person and Address ? Following is the POJO for Person and Address respectively. Person : public class Person { private int personID; private String name; private Person person; …
Suhail Gupta
  • 22,386
  • 64
  • 200
  • 328
1
vote
1 answer

How to get datasource from Hibernate Configuration

I would like to get a datasource from a hibernate Configuration programmaticaly. Here is the code that I wrote : public static DataSource getDatasource(Configuration configuration){ ServiceRegistry registry = new…
Dimitri
  • 8,122
  • 19
  • 71
  • 128
1
vote
2 answers

Hibernate Restricitions.ilike runs into error

Executing the following restrictions runs into following error Message: java.lang.String cannot be cast to java.lang.Integer if (suburbid > 0) { criteria.add(Restrictions.ilike("suburb.id", suburbid)); }
user2071377
1
vote
1 answer

How to insert using hibernate 4.1.10.Final?

I am using hibernate 4.1.10.Final to insert data into database, but it throws the following exception, I have three tables, development and address . Development has an object of address in itself. INFO: HCANN000001: Hibernate Commons Annotations…
user2071377
1
vote
1 answer

My hibernate mapping file doesn't pass the validation test and I get an exception as I try to run the program.Why is that?

As I try to run a program with the following xml mapping file, I get an exception which says : org.xml.sax.SAXParseException: The content of element type "joined-subclass" must match…
saplingPro
  • 20,769
  • 53
  • 137
  • 195
1
vote
1 answer

fluent NHibernate: many-to-many relationship with Product to Product

fluent NHibernate: many-to-many relationship with Product to Product.how i can implement it on asp.net mvc public class Product { public virtual int Id { get; set; } public virtual IList ManyProduct { get; set;…
smart boy
  • 671
  • 4
  • 11
  • 24
1
vote
5 answers

Is there a way to define reusable properties to n-hibernate mappings?

I have a scenario that i want to add some standard properties to my entities. Meaning that i will have e.g. 1 int and 2 string properties applied to all relevant entities. I have over 100 mapping files and most but not all will be hosts to these new…
Jaguar
  • 5,929
  • 34
  • 48