Win a copy of Svelte and Sapper in Action this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Duplicate collection role mapping

 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI,

I am new to Hibernate and i am tying to build a sample Hibernate application using the one given at http://www.laliluna.de/download/struts-hibernate-integration-tutorial-en.pdf

I am using eclipse to build this project.

I am having to tables, viz. book and customer. I have written a test code to save each of these objects in the DB.

The entity mapping files are similar, as mentioned in the tutorial.

But when I try to save these objects using session.save(),
I am getting the following exception


Can please anyone guide me on this.



 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you show us how you configure your SessionFactory?
 
Ashish Yannam
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Its an auto generated file form eclipse.
The HibernateSessionFactory is also auto generated.



 
author and cow tipper
Posts: 5000
1
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sounds to me like the Book class isn't mentioned in the configuration file. You're using mapping files, right? Each Java class that acts as an entity must be mentioned in the mappings section of the configuration file.

-Cameron McKenzie
 
Ashish Yannam
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am having entries for both the hbm.xml file in the hibernate.cfg.xml file.

here's the cfg.xml file

 
A magnificient life is loaded with tough challenges. En garde tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic