mark's blog

JPA Detached Object Gotchas

Java Persistence API detached object gotchas

One of the issues to get your head around in both Hibernate and JPA is how to handle detached entities. In Hibernate one has to deal with the session object and in JPA it is called the persistence context.

Cannot find the declaration of element 'persistence'

A common error when using EJB3 is

Cannot find the declaration of element 'persistence'

This is caused by a missing xml namespace attribute declaration in your persistence.xml file. To fix this error make sure your persistence tag has the following syntax:

<persistence xmlns="http://java.sun.com/xml/ns/persistence" version="1.0">

instead of

<persistence>

Maven and OpenJPA dependencies

I have been trying out Apache's openJPA EJB3 implementation recently and had to figure out what to include in the pom.xml to get it all to work with maven .

Initially I included the following dependency:

IP addy per capita

While surfing the net I came across this interesting lay study on the number of IP addresses per capita. From the map it appears that South Africa does quiet well for this unit of measure. According to the map we have 1 IP address for between 1-10 people. This puts us in the same bracket as Europe and behind the US and OZ.

Stop spam with a combined approach

Spam is the ban of any system administrators life and many people have taken it for granted that they must simply live with a certain level of spam in their day-to-day lives. However this does not have to be the case. A combined spam filtering approach is what is needed to end the spam problem. We find that a combination of blacklists and greylisting is the magic bullet that kills spam dead.

DB2 - platform and version migration/conversion

Recently we had upgraade a db2 8.1 database running on Windows to db2 9 running on a Linux based server. From the IBM documentation it appeared that it was possible to upgrade the database and change platforms but it was quiet difficult to find out exactly how.

Net-SNMP - How-to, Tips and Tricks

We recently setup opennms to monitor the status of a medium sized company with several Linux based servers. (opennms can monitor winows servers too.) The biggest challenge when setting up and configuring the system turned out not to be opennms itself, but rather snmp on servers.

A better filesystem with tagging?

Recently I had cause to reflect on just how inconvenient today's file systems are at organising information. I don't know about you but my desktop and home directory rapidly become filled with odds and ends that I have downloaded or created. I can start off with a clean home directory and within a space of 6 months its a complete mess.

Urban myth -- Demon Car or Insurance Ploy?

For about a month and a half now there has been an, apparently abandoned, car parked on the verge outside our offices on the corner of Kent and Bond street Ferndale. Initially we all assumed that the car had just run out of petrol or suffered some malfunction and that the owner would be back to pick up the car.

Software Freedom Day - YouTube videos

I have uploaded some of the video footage from Software Freedom Day. I am no movie director so the footage will not win any oscars. I haven't learnt to edit yet so it is all raw footage.

If you didn't manage to make that day, or are not located in Johannesburg or Pretoria, I hope this enables you to get some feeling for the event.

The Jumping Bean stand.