Well, I managed to get “JBoss”:http://www.jboss.org/ and “MySQL”:http://www.mysql.org/ working thanks to a kind friend who dug his config files out. Getting “Hibernate”:http://www.hibernate.org/ and JBoss working together was fairly simple, although I hate the fact that the Hibernate libraries have to be stuck in JBoss’s own lib directory thanks to one of its infamous class loader problems that never seem to get fixed. A minor hiccup was when JBoss forced the MySQL driver into an auto commit mode which it doesn’t support (this is despite MySQL’s own driver defaulting to false), although passing in a parameter to the JDBC URL fixed that.
Throughout the whole process I’ve found Hibernate very user friendly – the error messages are informative and helpful, which is more than can be said for JBoss and Tomcat. Next up I’m going to create a sample object model with some one to many relationships with both Hibernate and as Entity beans, to get a rough idea of performance.
November 8, 2003
“Hibernate”:http://www.hibernate.org/, as you may or may not be aware is a persistence engine for Java. As such it is by no means unique – it joins the ranks of JDO, Java Serialisation and the persistence features of the EJB specification as another option in an already crowded market. Good overviews on Hibernate can be found at the “official site(Hibernate and Tomcat Quickstart)”:http://www.hibernate.org/hib_docs/examples/quickstart/html/quickstart.html and in an article over at “The ServerSide(The ServerSide – Introduction To Hibernate)”:http://www.theserverside.com/resources/article.jsp?l=Hibernate
I like several things about Hibernate. Firstly it seems a lot quicker to develop than EJBs are.The classes you want to persist don’t need stub classes, or special interfaces – they are just normal beans. So not only can you quickly create these classes using code generation tools already in most modern Ode’s, but the beans themselves are abstracted from the method of persistence being used. Hibernate even ships with a tool to generate these classes from your mapping files, which is handy when used as part of an Ant build. Next, the definition of relationships is fairly easy – as is implementing lazy loading. The fact that you have to keep a Hibernate session if you want to use lazy loading of relationships is a pain but understandable.
The mapping files (which define the relationships between beans to be persisted and the datasource) is very straightforward, and as another nice touch Hibernate can read your mapping files and automatically create and keep in sync the database tables – again a great feature as part of a development build and deployment.
The reduced development overhead compared to EJB development coupled with the apparent performance improvements over simple untuned EJB applications means that I may find myself using this more and more. This weekend I’ll try and get a Hibernate-JBoss install working to carry out some simple performance comparisons between an EJB-based persistence and Hibernate based persistence.
November 7, 2003
Finally, after much cursing, shouting, drinking and general annoyance, I have managed to deploy a sample “Hibernate”:http://www.hibernate.org/ application. I must point out here that the problems I had have nothing to do with Hibernate – the documentation is excellent, although their sample application could be packaged a little better (you know, to actually produce a WAR file). The problem I had was with “Tomcat”:http://jakarta.apache.org/tomcat/.
Up to this point I have been using “Jetty”:http://jakarta.apache.org/tomcat/, because it just WORKS. It doesn’t have fancy web-based admin consoles or more config files than you cna shake a stick at, you just put your WAR file in its webapps directory, and restart. At which point it deploys your webapp. Tomcat however doesn’t do that – oh no. Sometimes it ignores your WAR file. Othertimes it unpacks it, but if it does it won’t update this unpacked directory structure if the WAR file changes even if you restart Tomcat. So now my build process has to delete directory structures under Tomcat (I’m sorry, but I am not going to start dealing with unpacked WAR structures – that way madness lies). Oh, and guess what? When Tomcat has an error with a web.xml, it doesn’t tell you which webapp it found the file in! Isn’t that cool! “Now if Jetty was so good, why are you using Tomcat?” you may ask Well, this may be lazyness on my part but the example application had the tomcat config settings and I didn’t feel like working out the equivelent Jetty settings (why can’t these things be standardised?).
Up to then things had gone well – I got “MySQL”:http://www.mysql.com/ installed and running as a service quite quickly. After finally getting the Hibernate example working I had a quick look at getting Hibernate and JBoss working together, but hit the problem that I couldn’t find any documentation explaining how to get “JBoss”:http://www.jboss.org/ working with MySQL – that excersie can wait for another day. Anyway, expect a brief writeup on Hibernate tomorrow – I must say that from what I’ve seen already it looks excellent.
November 6, 2003
Apparently Stuart’s “Sortable Table”:http://www.kryogenix.org/days/565.html code doesn’t work on the Safari browser, but this example does.
November 6, 2003
FeedDemon 1.0 Release Candidate 3 is now available – as always check release notes before installing. It looks like this will be the last release candidate before the full release – guess I’ll finally have to pay for this excellent product!
November 6, 2003
I’ve discovered a variety of solutions for providing rich UI controls for web-based applications of late:
* As mentioned before, the “Display Tag Library”:http://displaytag.sourceforge.net/ provides a JSP custom tag lib for producing CSS-styled tables with sorting, grouping, paging and various export formats. Its easy to use and works well, although could do with some updates to work better with the JSTL and JSP Expression Language.
* “Stuart Langridge’s”:http://www.kryogenix.org/ “DHTML sortable tables”:http://www.kryogenix.org/days/565.html provide a client-side solution to sortable tables – it doesn’t offer as many features as the Display Tag Library but is very easy to use and is great if you can’t rely on server side software, or even if you can but can’t use taglibs
* Via “Zeldman”:http://www.zeldman.com/daily/1003b.shtml#cssdropdowns, “Brainjar(Brainjar – Revenge of the Menu Bar Demo)”:http://www.brainjar.com/dhtml/menubar/demo2.html has some very good looking DHTML drop down menus
* Common Controls provide a set of commercial Tag libraries that integrate with struts to produce some very nice looking controls. The fact that they integrate with Struts is a big plus – one of the problems with the Display Tag Library is that it doesn’t integrate with struts too well. The big problem is that they want a per-server license AND developer licenses. Its not too expensive if you only have one developer and one server, but if you are deploying several servers (as some of my friends are) it can soon get quite expensive. If they offered a flat-fee rate I’d be more interested.
* The “struts menu”:http://struts-menu.sourceforge.net/ is an open source project that as you’d expect gives you nice menus, but isn’t tied to struts any more. Some of the menus it produced did cause problems under firebird however.
November 5, 2003
I have decided to deprecate support for the “older RSS 1.0 feed”:http://www.magpiebrain.com/index.rdf, in preference for a newer “2.0 feed”:http://www.magpiebrain.com/index.xml. If your reading this via an aggregator it might be an idea to swap over now. I’ll probably still generate the old feed, for a while longer, but won’t be doing much with it.
November 5, 2003
Finally got around to adding a search to the site – I’ll be adding an advanced search feature as soon as I get my head around the tags. Yell if there are any problems!
November 5, 2003
Right now, I am supposed to be on my way to seeing the “Flaming Lips”:http://www.flaminglips.com/main.php, one of the best live bands on the planet, at the “Hammersmith Apollo”:http://www.carlinglive.com/venue_content/carling_hammersmith_apolo.html. Instead, I am trying to work out why one of our warehouse management systems stopped working, and why even after I’ve cobbled together a fix for a problem I don’t understand won’t it accept a file its been accepting quite happily for the last couple of months. An even bigger problem is that I don’t have the file the file in question to hand – its being emailed to me as we speak. So I’m just sitting around, waiting for the ruddy file to arrive, which inevitably will of been mangled by someone at the warehouse…oh well…
_Updated 7:29pm_: Well, finally got the email at the second attempt, everythings sorted so now its time for a mad dash across London to try and get to the concert in time….who wants a bet that the underground will get flooded or something?
November 4, 2003
So there I was, trying to create an XSLT style sheet for my RSS 2.0 feed, when I managed to overwrite the main index.html template for my blog with the RSS 2.0 template. Thankfully a friend pointed out than I’d made a right asshat of myself – I’ve restored and earlier version of the template in the meantime, as I won’t have time to fix it properly until tomorrow, as I’m off to see the Flaming Lips tonight…
November 4, 2003