Friday, August 27, 2010

Sneaky Tomcat

Ubuntu's Update Manager insisted for days and days that I needed to upgrade Tomcat's manager due to security patches. I should have just ignored it (just kidding).  After I went ahead with the update, I've spent hours and hours trying to resurrect the webapps installed in Tomcat before realizing what was actually going on. Reminder for next time: check which config settings did the upgrade changed, paying particular attention to how JAVA_HOME is being set and what are the new memory usage limits (for Tomcat6/Ubuntu this settings can be found in /etc/init.d/tomcat). More info can be found at Installing Tomcat 6 in Ubuntu. One more tip: after the settings have being fixed, Tomcat might still have trouble bringing back "online" all the webapps at once, so the option here is to let Tomcat bring them back one by one by moving the apps folders out of /tomcat/webapps.

Thursday, August 19, 2010

I used to like Cascades

Oooch! Ooooch! Oooooch! Hibernate is being a pain to grasp for me :'( .... Actually, at least in this case, the JPA/Hibernate combo was the one kicking my rear this time. Turns out that there are two "flavors" of CascadeTypes: JPA's and Hibernate's. Oh!, and don't you dare ignoring the Hibernate ones if you are using it as your persistence "back-end' :-P

I cannot thank mkyong enough for saving me from spending many more hours digging around and "experimenting" to solve foreign key constraint issues with his post on Cascade – JPA & Hibernate annotation common mistake. I have just one comment to add to what he posted: for the Hibernate CascadeType to "kick in", I still needed to specify the JPA one in my entity. Per Hibernate's documentation on cascading this is recommended, but in my case it seems to be actually required :|