Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Hbm2JavaTask won't generate composite user types correctly

 
Pierre Sugar
Ranch Hand
Posts: 62
Java Ruby Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am using Hibernate 2.1.8.

I have a POJO called Location and on that I created a Hibernate composite user type called LocationType. I use the LocationType within a hibernate mapping file Travel.hbm.xml as follows.



Though Travel.java is generated when running the Hbm2JavaTask, LocationType is implemented instead of Location.



When I fix it manually to Location the class works as it should.

Does anybody know how to fix it as it is somehow error-prone?

Thanks in advance.

Pierre
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You are mapping your composite key as a property, not a composite key. IS this deliberate? I'd expect the composite key to be mapped like this:
 
Pierre Sugar
Ranch Hand
Posts: 62
Java Ruby Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't think this is the problem, as my mapping works as it should when fixing e.g. LocationType to Location. I have now managed to get the logging output and hbm2Java tells me that it cannot find the UserType.



Does anybody have an idea what that means.
Thank you
 
Pierre Sugar
Ranch Hand
Posts: 62
Java Ruby Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
All right that was trivial. hbm2java expects the user type in the classpath. As I had a separate classpath for hbm2java without the classes directory, hbm2java couldn't find the LocationType.class.

Sorry for being harassing with that beginners mistake. Thanks to all that had a look to this post.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic