Checking if hibernate3 is present or not to avoid getting a ClassCastException