File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Object Relational Mapping and the fly likes Duplicate collection role mapping Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Duplicate collection role mapping" Watch "Duplicate collection role mapping" New topic
Author

Duplicate collection role mapping

Ashish Yannam
Greenhorn

Joined: Sep 05, 2007
Posts: 19
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.



Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

Can you show us how you configure your SessionFactory?


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Ashish Yannam
Greenhorn

Joined: Sep 05, 2007
Posts: 19
Its an auto generated file form eclipse.
The HibernateSessionFactory is also auto generated.



Cameron Wallace McKenzie
author and cow tipper
Saloon Keeper

Joined: Aug 26, 2006
Posts: 4968
    
    1

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

Joined: Sep 05, 2007
Posts: 19
I am having entries for both the hbm.xml file in the hibernate.cfg.xml file.

here's the cfg.xml file

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Duplicate collection role mapping
 
Similar Threads
InvalidMappingException
Duplicate collection role mapping
org.hibernate.DuplicateMappingException: Duplicate collection role mapping
hibernate error
Duplicate Hibernate mapping exception