-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 9 posts ] 
Author Message
 Post subject: Mapping ORACLE TIMESTAMP(9)
PostPosted: Sat Nov 01, 2008 1:38 am 
Newbie

Joined: Sat Nov 01, 2008 1:19 am
Posts: 5
I am using seam gen to reverse engineer an Oracle database with fileds of the TIMESTAMP(6) type. When I reverse engineer these tables it marshalls TIMESTAMP(6) to java.io.Serializable. After adding this type mapping node:

<hibernate-reverse-engineering>
<!-- Added by JEEads to take care of TIMESTAMP mapping issue 10/31/08 -->
<type-mapping>
<sql-type jdbc-type="TIMESTAMP" hibernate-type="java.sql.Timestamp" />
<sql-type jdbc-type="NUMERIC" hibernate-type="java.lang.Long" />
<sql-type jdbc-type="DECIMAL" hibernate-type="java.lang.Long" />
<sql-type jdbc-type="VARCHAR" length="1" not-null="true" hibernate-type="java.lang.Character" />
<sql-type jdbc-type="VARCHAR" length="1" hibernate-type="char" />
<sql-type jdbc-type="VARCHAR" hibernate-type="string" />
</type-mapping>


<!-- This file is intentionally generated empty by seam-gen -->
<!-- You can add any filtering/setup you want for your app -->

</hibernate-reverse-engineering>

the problem persisted. How do I need to type map the ORACLE TIMESTAMP(6) so it maps to java.sql.Timestamp?


Thanks
Jerry


Top
 Profile  
 
 Post subject:
PostPosted: Sun Mar 22, 2009 3:36 pm 
Newbie

Joined: Sun Mar 22, 2009 10:48 am
Posts: 2
Has anyone been able to solve this problem? I'm going through exactly the same thing, and the mapping file is not working in my case either.

I've even tried length="6", but no luck.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Mar 22, 2009 10:28 pm 
Newbie

Joined: Sat Nov 01, 2008 1:19 am
Posts: 5
I found that oracle Timestamp maps to sql Other so what I did was change the generlated files so instead of Serializable the Timestamps map to Timestamp. It is a hassle but it works fine. Another issue I had was that many of the CMR's are mapped to Set rather than List which rich:dataTables and subTables cannot use. I changed those to List and they work fine.

Hope this helps.

Jerry


Top
 Profile  
 
 Post subject:
PostPosted: Mon Mar 23, 2009 7:52 am 
Newbie

Joined: Mon Mar 23, 2009 7:28 am
Posts: 1
I have 70+ tables in my database and each table contains average 20-30 fields. If i have to change the datatypes manually it will take ages. I added the following lines in seam-gen.reveng.xml files.
<type-mapping>
<sql-type jdbc-type="TIMESTAMP" hibernate-type="date" length="9"/>
<sql-type jdbc-type="INTEGER" hibernate-type="java.Lang.Integer" />
<sql-type jdbc-type="NUMERIC" hibernate-type="java.Lang.Float" />
<sql-type jdbc-type="DECIMAL" hibernate-type="java.Lang.Double" />
<sql-type jdbc-type="VARCHAR" length="1" not-null="true" hibernate-type="java.lang.Character" />
<sql-type jdbc-type="VARCHAR" length="1" hibernate-type="char" />
<sql-type jdbc-type="VARCHAR" hibernate-type="string" />
</type-mapping>

Still Seam is generating Timestamp -> Serializable, INTEGER,NUMERIC,DECIMAL -> BigDecimal.

Can anyone assist?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Mar 23, 2009 4:30 pm 
Newbie

Joined: Sun Mar 22, 2009 10:48 am
Posts: 2
What I ended up doing is making an Ant build task that runs right after the hibernate reverse-engineering task.
Its an Ant "replace task" that searches for 'type="serializable"' and replaces it with 'type="java.sql.Timestamp"'.
I could have used a more precise / complicated Ant replaceregex task to ensure I'm only replacing serializable where there's a TIMESTAMP, but I only have 'type="serializable"' where I was expecting 'type="java.sql.Timestamp"', so I'm not overwriting any unintentional fields.


Top
 Profile  
 
 Post subject: Re:
PostPosted: Thu Jul 09, 2009 3:24 am 
Newbie

Joined: Wed May 09, 2007 5:22 am
Posts: 4
sanjaybhatt73 wrote:
I have 70+ tables in my database and each table contains average 20-30 fields. If i have to change the datatypes manually it will take ages. I added the following lines in seam-gen.reveng.xml files.
<type-mapping>
<sql-type jdbc-type="TIMESTAMP" hibernate-type="date" length="9"/>
<sql-type jdbc-type="INTEGER" hibernate-type="java.Lang.Integer" />
<sql-type jdbc-type="NUMERIC" hibernate-type="java.Lang.Float" />
<sql-type jdbc-type="DECIMAL" hibernate-type="java.Lang.Double" />
<sql-type jdbc-type="VARCHAR" length="1" not-null="true" hibernate-type="java.lang.Character" />
<sql-type jdbc-type="VARCHAR" length="1" hibernate-type="char" />
<sql-type jdbc-type="VARCHAR" hibernate-type="string" />
</type-mapping>

Still Seam is generating Timestamp -> Serializable, INTEGER,NUMERIC,DECIMAL -> BigDecimal.

Can anyone assist?


How about using this:

<sql-type jdbc-type="OTHER" hibernate-type="java.sql.Timestamp" />

This works for me, because I only have oracle timestamp mapped to jdbc type other.

I don't know if this is Hibernate Tools bug or not? I hope to hear from Hibernate guys.


Top
 Profile  
 
 Post subject: Re: Mapping ORACLE TIMESTAMP(9)
PostPosted: Sun Aug 02, 2009 10:26 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
Tuno is right - that is the current "workaround"

To get it fully solved we shuold have a db-type or native-type to match on too so we can support drivers who doesn't support jdbc metadata typesystem fully.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject: Re: Mapping ORACLE TIMESTAMP(9)
PostPosted: Thu Dec 05, 2013 10:45 pm 
Newbie

Joined: Thu Dec 05, 2013 10:44 pm
Posts: 1
Has this been resolved? I'm having the same issue and would like to use something better than a workaround that maps all unrecognized types to Timestamp.


Top
 Profile  
 
 Post subject: Re: Mapping ORACLE TIMESTAMP(9)
PostPosted: Fri Dec 06, 2013 6:35 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
jzwolak wrote:
Has this been resolved? I'm having the same issue and would like to use something better than a workaround that maps all unrecognized types to Timestamp.


unfortunately not. contributions welcome.

_________________
Max
Don't forget to rate


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 9 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.