DDD Specifications with Hades
Two weeks ago, I attended Java Forum Stuttgart, a really nice one-day conference to hear interesting talks, meet fellow developers and colleagues. The first talk I attended was held by Adrian Hummel and Mischa Kölliker entitled Rich domain model with JPA 2.0. As I am currently working on the final features for Hades 2.0 which will be based on JPA 2.0, I was eager to see what they were about to present.
Hades – standing on the shoulders of giants
In the last few days I have been working on a feature request of Hades that has been after me for quite a long time. Hades has always had built in support for auditing entities, which means it captured the current user of the application and set it as the creator or modifier on the entity whenever you called save on a Hades DAO. This is based on AOP, has always been a nice showcase of AOP applied, hopefully served a few users quite well. So far so good. Unfortunately the way it was implemented had two serious drawbacks:
- It only works if you call
MyDao.save(…)explicitly - It only works for the root entity you persist, not transitive ones.
These drawbacks have caused Will Jaynes to open up a ticket over a year ago already and I have been thinking about that issue from time to time, sometimes more deeply, sometimes just remembered it was still open. Finally I came up with a solution that not only fixes the two points mentioned above but also acts as a quite nice example of how powerful Spring as a toolbox can be, especially for framework or library developers. Here’s the story…
Hades 2.0.0.RC2 introduces transactional DAOs
Our latest Hades release of the 2.0 branch is introducing transactionality of DAO instances as main new feature. Of course you can read up the reference documentation for some general guidelines but I want to use the chance to give a more detailed look into why we introduce this and how some details work.
Changing a project’s artifact id in Sonar
Sonar is a great tool to take care of code quality in your software projects. I use it heavily to monitor the open source projects I am involved with. When working on getting Hades published into Maven central I had to polish it’s pom.xml and felt the need to align the parent project’s artifact to our chosen OSGi compatible package notation for artifacts. So prior to releasing it to Maven central I changed the artifact id from hades-parent to org.synyx.hades.parent. Everything fine until I pushed the metrics of the 1.5.1 release into Sonar.
Sonar created a new project, as it cannot know about my refactoring. So what to do? I spoke to Simon Brandhof and apparently there’s no feature in Sonar to change the artifact id via the user interface. So I opened a JIRA issue for it, feel free to vote for it if you like. Meanwhile we could achieve this by manually altering the kee column inside the PROJECTS table. It contains entries of the form ${groupId}:${artifactId}(:${branchName}) for entries of type PRJ (i guess that stands for project. Altering these entries solved the problem.
Thanks to Simon and Verschdl for help!
Previous Articles
Your daily quote...
"Mir fällt so vieles ein, doch das hat damit nichts zu tun / diese Stadt ist mir zu klein, doch sie leuchtet und überall bist du"(Clueso - Überall bist du)


