Hibernate generating entities with timestamps from Oracle

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. 😉

Advertisements

About virgo47
Java Developer by profession in the first place. Gamer and amateur musician. And father too. Naive believer in brighter future. Step by step.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s