In this chapter, we add an Entity called „Artist“ as well as an entity called „Comments“.
Copy both Track.hbm.xml
and Artist.hbm.xml
from the examples-distribution and remember to change the DTD-reference if necessary.
When using „ant schema
„, SAX complained it couldn’t find ${src.root}/com/oreilly/hh/hibernate-mapping-2.0.dtd
for Artist.hbm.xml
.
That’s strange because it didn’t complain about it in Track.hbm.xml
before. However, I place the DTD file in ${src.root}/com/oreilly/hh
and the prepare-target now copies *.dtd
file, too.
The code generation is no problem. I has changed CreateTest.java
again according to Java-beans coding style.
The package name in QueryTest.java
and QueryTest2.java
needs to be changed again from „net.sf.hibernate...
“ to „org.hibernate...
“ and everything works.
So that’s it for chapter 4.