-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 6 posts ] 
Author Message
 Post subject: net.sf.hibernate.MappingException: duplicate import
PostPosted: Wed Nov 26, 2003 11:28 am 
Beginner
Beginner

Joined: Wed Nov 26, 2003 9:04 am
Posts: 23
hello

I was wondering if anyone can help shed some light on why I get mapping exception that claims I have a duplicate import when I don't appear to (at least not in hibernate.cfg.xml). I'm sure there will be an explaination for this behavoiur so any help would be appeciated, even if its just a link i should read. I need to gain a little more insight into whats going on to shape my question a little better.

Many thanks

Mark


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 26, 2003 11:48 am 
Regular
Regular

Joined: Sat Oct 18, 2003 11:53 am
Posts: 55
If you look at the exception stack trace, you might notice there is another exception below that is the real cause.

Sometimes when a mapping exception happens the session factory does not handle it correctly and it turns into a Duplicate Import Exception. I think this is a bug.

-Matt


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 26, 2003 11:59 am 
Beginner
Beginner

Joined: Wed Nov 26, 2003 9:04 am
Posts: 23
I've pasted my stack trace below.. As I said before I'm really looking for some material that will help me understand what's going on.

So the hibernate.cfg.xml gets parsed into a bunch of imports, are one-to-many and many-to-one relationship's included in this. If i've got my relations wrong will it throw this? Or should I be confident that things will start but then throw errors when I attempt to run them?

Many thanks Mark

net.sf.hibernate.MappingException: duplicate import: Product
at net.sf.hibernate.cfg.Mappings.addImport(Mappings.java:60)
at net.sf.hibernate.cfg.Binder.bindClass(Binder.java:108)
at net.sf.hibernate.cfg.Binder.bindRootClass(Binder.java:165)
at net.sf.hibernate.cfg.Binder.bindRoot(Binder.java:1095)
at net.sf.hibernate.cfg.Configuration.add(Configuration.java:230)
at net.sf.hibernate.cfg.Configuration.addInputStream(Configuration.java:252)
at net.sf.hibernate.cfg.Configuration.addResource(Configuration.java:273)
at net.sf.hibernate.cfg.Configuration.configure(Configuration.java:841)
at net.sf.hibernate.cfg.Configuration.configure(Configuration.java:792)
at net.sf.hibernate.cfg.Configuration.configure(Configuration.java:746)


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 26, 2003 12:11 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
Quote:
Sometimes when a mapping exception happens the session factory does not handle it correctly and it turns into a Duplicate Import Exception. I think this is a bug.


Yes, I've noticed this. I don't know why. If someone could figure this out it would be nice.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 26, 2003 12:22 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
P.S. this exception probably just means that you loaded the mapping for a class twice, or have two mappings for the same class name.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 26, 2003 1:20 pm 
Beginner
Beginner

Joined: Wed Nov 26, 2003 9:04 am
Posts: 23
ner its only there once.. It must be something to do with how it builds the relationships..

I assume that is basically a post validation (I mean that the xml is valid but the content (relationships etc) aren't) error that gets thrown when the relationships are correct.

I didn't take much notice whether all my xdoclet tags were correct, so I'm working on the premiss that thats what's going on.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 6 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.