Thursday, April 19, 2007

Development underway!!

I've started developing MLTA, using what I would consider "best practice" open source technolgies; MySQL with Spring, Hibernate and Struts2 for the front-end, running on Tomcat. I've also started using JPA - I totally love it!! Annotations are the best thing to happen to Java in a long while IMHO. I am not a big fan of writing XML configuration files, so I love it that I can use Hibernate JPA annotations on my model classes and it all gets wired up.

One super gotcha that took me a while to work out was that you can't mix where you put your annotations within a file. What I was doing was putting the @Id annotation above the member variable declaration, than a @OneToOne annotation above a getter. This caused a "Could not determine type for: xxx, for columns: [org.hibernate.mapping.Column(yyy)]" where xxx was the target of the One To One and yyy was the column affected. Once I moved the @Id annotation to above the getter as well, everything worked. I'm sure it's documented somewhere, but seeing as I'm teaching myself using web resources as fast as I can, I probably missed a rule or 2 somewhere.

I had a look at the Spring MVC component, but I think I'm going to stay with Struts2 (aka WebWork). Spring has some nice stuff, but I just can't go past Struts2's xml vslidation and rich taglib, which is miles ahead of Spring atm. I'll keep an eye on Spring MVC, as I'm sure it'll continually be improving, but for now it's Struts2 for me.

No comments: