-->
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.  [ 2 posts ] 
Author Message
 Post subject: Suggestion for hbm2dll - Vague Error Msg Needs More
PostPosted: Wed May 31, 2006 4:33 pm 
Regular
Regular

Joined: Sun Sep 26, 2004 9:27 pm
Posts: 75
Location: Atlanta, GA, USA
In working out the kinks in switching over to Annotations and using hbm2dll, I came across the following error:

Code:
[hibernatetool] Problems in creating a Ejb3Configuration. Have you remembered to add it to the classpath ?
[hibernatetool] java.lang.reflect.InvocationTargetException
[hibernatetool] javax.persistence.PersistenceException: org.hibernate.MappingException: Could not determine type for: p2p.common.user.User, for columns: [org.hibernate.mapping.Column(userId)]
[hibernatetool] org.hibernate.MappingException: Could not determine type for: p2p.common.user.User, for columns: [org.hibernate.mapping.Column(userId)]


At first, this message seems to describe a problem with a column definition (or reference) named 'userId' within my User class. I do have a @JoinColumn annotation that attempts to name the key reference 'userId,' but that wasn't the problem.

To make a long story short, I found the problem in a different class that was not referenced by the error message. It looked like the following:

Code:
   @Column(name="userId", nullable=false)   
   private User mUser ;


But should look like this:

Code:
   @ManyToOne
   @JoinColumn(name="userId", nullable=false)
   private User mUser ;


So, my long winded request is as such.... I'd love to see a little more information for this type of error from the MappingException. Is it possible to have something like this instead?

Code:
[hibernatetool] org.hibernate.MappingException: Could not determine type for: p2p.common.user.User, for columns: [org.hibernate.mapping.Column(userId)] as referenced in class: p2p.common.user.UserAlias.


Noting the problem area would help with debugging.

If I need to post this request elsewhere, let me know.

Thanks as always.


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 31, 2006 4:43 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
So the short version is: No.


the longer version is that you get an error for a column because hbm2ddl just looks at things from the perspective of the db, e.g. table/columns.

I would actually presume that you would get another error message when/if you try to use this mapping via EJB3/Hibernate.

/max

_________________
Max
Don't forget to rate


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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.