Posts Tagged ‘java’

ORM Anti-pattern – Right conclusion, wrong reasons – Rebuttal

This is a rebuttal for Right conclusion, wrong reasons  ( ) for an ORM being an anti-pattern.

The main purpose of an ORM (Object Relational Mapper) is to fix the object-relational mismatch, which is a mismatch between how an object is treated differently by the object oriented and relational paradigms which are fundamental constructs in programming and data storage/retrieval. The mismatch is well addressed by Scott Ambler of the Agile Manifesto (, Jeff Atwood of Coding Horror (

The traditional waterfall method handles this problem by trying to identify all entities and relationships before development begins. However the Rational Unified Process (RUP), Scrum and other agile development methods, however face a problem in that the data model changes, drastically during development, as more information becomes available and the client/implementation team learn more about the solution and business needs.

Hard-coding SQL statements becomes critical as these changes are not easily reflected as the database model evolves. ORMs like Hibernate ( and Doctine ( provide a means of mapping the POJOS (Plain Old Java Objects) and POPOs (Plain Old PHP Objects) into relational tables via XML mappings, and annotations (depending on your needs). As your model changes rapidly, all u have to keep changing is the database schema and object definitions.

The major strengths are also a big weakness, ORMs generate generic SQL which is not very optimized, so is slow when using traversing the object graphs, however a mix of ORM access (content pages, display pages where most attributes are displayed) and straight SQL (for lists and pagination) tends to reduce the impact of a the problem.

I have no experience in the new NoSQL data stores so I do not know what the implications are, but ease of unit testing, tool support etc, save time especially when the changes are rapid 🙂


Java Content Management System Woes – OpenCMS 6.2

We are working on migrating an OpenCMS website from one look to another. As expected of all development projects, this cannot be done on the production server, so we are setting up a development environment for the site within our local network.

While the basic tools have become better, Java and Tomcat seem faster than when I had a version 4 of each, it seems like OpenCMS and maybe other Java applications are still mired in the past. Setting up a PHP based CMS, Joomla or WordPress (have not used Drupal) are straight forward, migrating from one server to another is as simple as copying the files, updating the database, and poof ur off.

OpenCMS, is a totally different beast all together, it is not clear what is stored on the file system and what is stored in the database, and even when you get a strange error like

ERROR [.workplace.CmsWorkplaceManager:1288] Error reading view folder: [B@111ad13/
org.opencms.file.CmsVfsResourceNotFoundException: Error reading resource from path "/[B@111ad13/".

You are left wondering where the hell do I find the missing file or resource for one Google is no help either. Nothing is clear with Java, and Java based applications.

The hair pulling goes on, and one wonders whether I will be bald by the time this is fixed.

%d bloggers like this: