Hibernate generating entities with timestamps from Oracle
January 31, 2009 Leave a comment
Sometimes it’s hard to find who’s to blame. Reportedly it’s Oracle driver this time. I’ve used JBoss Seam and its great seam-gen to start my project right with some entities. I used Oracle’s timestamp datatype and I was quite angry when it was translated to Serializable. I hope you agree with me that Serializable is way too impractical.
As we’ve tried the same process before with H2 and PostgreSQL I was pretty sure it’s the problem between Hibernate (hbm2ddl more precisely) and Oracle. As it turned out it’s rather Oracle JDBC Driver issue: http://opensource.atlassian.com/projects/hibernate/browse/HBX-700
As I didn’t expect any other datatype to return OTHER I changed the mapping setup in resources/seam-gen.reveng.xml:
<sql-type jdbc-type="OTHER" hibernate-type="java.util.Date"/>
I needed Date this time, you might prefer other Hibernate type – the point is know what the problem is. I would think more people already hit the problem but it wasn’t so straightforward to get to the right answer actually. Hope this short post will help someone else.


Recent Comments