I've recently ported my application from hibernate2 and middlegen to hibernate3 and hibernate tools. I've read all the documentation, and finally gotten my application to compile and run successfully. However, there are a few things I haven't been able to figure out.
(1) When I run hibernate tools, I use a direct JDBC connection to the database, which I specify in a hibernate.properties file. However, the application uses a JNDI connection (specified in hibernate.cfg.xml). If I use the <hbm2cfgXml> target, it will write an hibernate.cfg.xml file which has the JDBC bindings. However, I want the mappings to be updated, so that when a new database table is added, it is properly reflected. How can I do this? (Right now, I'm handling this with a python post-processing script, but that is not ideal).
(2) I'd like to add some more java code tothe POJO's created by <hbm2java>. There is mention of a templates dir in the hibernate tools documentation, but no examples on how it works, and no templates. How do I do this? In particular, I'd like to add serialVersionID to every POJO (to stop getting warnings), and I'd like to add a multiple-arg constructor that takes every column (except the sequence primary key if present).
(3) Speaking of sequences, hibernate tools fails to recognize sequences (in postgresql). I had to modify the .hbm.xml files by hand to insert <generator class="sequence"> and add the <param name="sequence">database_sequence_id</param>.
(4) How do I add <cache usage="transactional"/> to all .hbm.xml files? I've had to do this by hand as well.
(5) When I run with a log4j.xml set to ERROR, I see this error repeated over and over
[hibernatetool] 14:57:01,754 ERROR [template] Left side ($property.cascade) of '!=' operation has null value. Operation not possible. hbm/many-to-one.hbm.vm [line 13, column 26]
[hibernatetool] 14:57:01,757 ERROR [template] RHS of #set statement is null. Context will not be modified. hbm/many-to-one.hbm.vm [line 16, column 1]
[hibernatetool] 14:57:01,757 ERROR [template] Left side ($fetchmode) of '!=' operation has null value. Operation not possible. hbm/many-to-one.hbm.vm [line 17, column 19]
[hibernatetool] 14:57:01,789 ERROR [template] Left side ($property.cascade) of '!=' operation has null value. Operation not possible. hbm/many-to-one.hbm.vm [line 13, column 26]