Thursday, February 28, 2008

Hibernate reverse engineering and "yes_no" columns

Since attending JBossWorld Orlando, I've been playing with the JBoss Developer Studio. I've had some problems with reverse generation of my entities, and so I thought I'd post some of the solutions.

My database uses logical deletes ("Y" and "N".) The generated entities, which were typed as Boolean's choked on insert.

I haven't had much luck yet customizing the generation from the JBoss Developer Studio menu , and so I've been using the Hibernate Tools for Eclipse to generate my entities into a separate project, ModelProject, and then copying them into a seam project.

My plan was to use Seam tools to generate the crud ui from the project. However, right clicking the project and choosing "New -> Seam Generate Entities" and then selecting "Use existing entities" didn't do anything.

I started over and did the following :
ran seam-gen from the command line and created a new project, SeamProject
imported the resulting project into Eclipse
copied the reverse-engineered entities from ModelProject into SeamProject
ran "seam generate-ui" from the command line

This worked beautifully. The only hitch was I kept getting a vague error from DB2/400 when I tried to create a new entity, "[SQL0545] INSERT or UPDATE not allowed by CHECK constraint."

I checked all the constraints and after a few failed attempts determined that I wasn't violating any foreign keys. There were only a couple of not null fields one of which was the logical delete column. I had entered the translation I wanted into the hibernate.reveng.xml file (or at least I thought I had), but there was no annotation for "yes_no." I simply added @Type(type="yes_no") to the field, and everything worked.

Blogged with Flock

Friday, February 15, 2008

JBoss World Orlando - Friday

EJB3, Seam, JSF, and RichFaces on JBoss 4.2.0 was the first session I attended. It was a case study of easycredit a German loan system. I've found the case studies useful.

The second session I attended was a 90 minute JBoss Developer Studio workshop. I had already installed the JBoss Tools project into Eclipse so I was glancingly familiar with it; however, I've used seam-gen for the projects I've been working on and hadn't made use of the Developer Studio tooling. Reverse engineering a domain model is stupidly simple.

Agile Development Using JBoss Seam was the third session I attended. Daniel Hinojosa was the speaker, and he had some cool tips on using Groovy for unit testing that I want to check out. He also showed off some stuff that I didn't know Hudson could do.

Testing JSF Applications which was an intro to JSFUnit by Stan Silvert was another session that I really liked, meaning I will start using JSFUnit next week. The executive summary is that resulting from his hatred of Mock objects, Stan created a JSF testing framework that works inside the the container without all the overhead of Cactus.

Some Other JBossWorld Bloggers

Daniel Hinojosa is currently speaking (I'm in his seminar now) and blogging about the show on his evolutionnext blog.

Thursday, February 14, 2008

JBoss World Orlando - Thursday

Introduction into JBoss Drools and the Business Rules Management System (BRMS) by Mark Proctor was the first session I attended.

Drools/JBoss rules is really cool. The web based BRMS system looks very nice, and offloading the maintenance to the business users is a must anyway. I'll be using this soon.

I found the keynote by Vefim Natis from Gartner interesting. Although I am way tired of hearing about SOA I still got a lot out of his talk. Some of his points :
  • Gartner's hype cycle currently puts SOA entering mainstream acceptance.
  • SOA is primarily about business modeling : identifying the business components that need to be developed as software.
  • Establishment of an Integration/SOA Competency Center (ICC) is the barometer of success
  • Heterogenous software/environments are not only necessary, but should be regarded as a goal.
The Hibernate Search session was impressive. Emmanuel Bernard, the project's team lead was the presenter. I didn't have a lot of experience using Lucene (one project a few years ago), but it looked like they've done a nice job wrapping Lucene and providing an API that should be familiar to Hibernate users.

Wednesday, February 13, 2008

JBoss World Orlando - Wednesday

I'm at JBossWorld Orlando. We got the usual t-shirt and bag, but the 1G flash drive was definitely the best schwag I've picked up (I didn't take a single pen during the vendor meet and greet!)

I checked out the jBPM session, "A Lightweight Approach to Business Processes With JBoss jBPM", first. I would've liked more practical use information, but the overview of the jBPM platform, which is how Tom Bayens described it, was interesting.

The next session on "Seam, SEAM, AS, EJB3, Hibernate, AJAX4JSF, RichFaces, and Facelets", was given by four guys from Big Lots. It was an excellent talk. I don't know how much presenting they do, but they traded off easily and kept the talk moving really well. It didn't hurt that their case study was very relevant to the project I'm working on.