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

hibernate xml not found (jboss plug in)

 
jay vas
Ranch Hand
Posts: 407
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Guys :

Well I finally (by a stroke of luck) got hibernate to generate the
mapping files - but now when I try to refresh them (Im using the jboss eclipse hibernate plug in) it sais "file not foudn dao/Actor.hbm.xml".

I have checked and that xml file is in fact at that location.

Any ideas as to why hibernate cant find files that are in its same directory in eclipse ? Ive even tried moving the xml file to the root directory and it still couldnt be found !

Thanks

-J
 
jay vas
Ranch Hand
Posts: 407
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Okay, I found a hack workaround : If you look in the hibernate.cfg.xml file, you will find that all the objects are the xml files have their folder paths on them i.e. an xml map for Object A in directory d is shown as

<mapping resource="d/A.hbm.xml" />

Now, if you remove the d :

<mapping resource="A.hbm.xml" />

And simultaneously make sure that the directory is still a member in the console configuration's classpath, then hibernate will find the hbm.xml file automatically.

I would note that this should be changed... The resource name is defined in 2 places (its path is in class path , its name in the cfg.xml file). It seems like in an effort to decouple data access code from database implementation the folks at hibernate has created plugins that reduce architectural coupling, but in and of themselves, are in fact highly coupled, at times in a very counterintuitive way !

Nevertheless, once I got the maps to generate - it was very cool to see all the working available dao code !

j
 
bilal haider
Ranch Hand
Posts: 47
Java Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And mine case is reversed.
I was getting same problem . Person.hbm.xml not found.
in hibernate.cfg.xml i had: <mapping resource="org.app.dal.domainobject.mapping.Person.hbm.xml"/>
when i changed this with <mapping resource="org/app/dal/domainobject/mapping/Person.hbm.xml" /> itworkd.
i spent 1-2 hour as i get frustrated why app is not finding hbm file.
Thanks for "hack workaround". i just reversed it.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic