Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » [Teneo] Recommended way to override Java to DB Type Mapping for various databases( Recommended way to override Java to DB Type Mapping for various databases)
icon5.gif  [Teneo] Recommended way to override Java to DB Type Mapping for various databases [message #915989] Tue, 18 September 2012 11:15 Go to next message
Josh A is currently offline Josh AFriend
Messages: 13
Registered: September 2012
Junior Member
Hi,

For various DB Dialects(DB2,Oracle,MS-SQL & Postgres are the ones i am most interested in), Is there a way to influence Java type to DB Type mapping in Teneo?

For example, is there a way to indicate to teneo to map a given EAttribute to a 'datetime2' type column in MS-SQL?

I came across the following Hibernate annotation which looked promising @Type(type="timestamp"). However, i am not sure what is the equivalent for timestamp2 in this annotation?

I guess the other option is to create a new hibernate UserType and map it via @Type(type="org.example.test.annotations.TimeStamp2Type")?

Thanks for your help,
Josh
Re: [Teneo] Recommended way to override Java to DB Type Mapping for various databases [message #916346 is a reply to message #915989] Tue, 18 September 2012 22:46 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Josh,
If you want different mappings for different databases then I would create your own Dialect variant, overriding the
standard ones provided by Hibernate.

Check the Dialect implementation to see what to override (for example registerColumnType).

On 09/18/2012 01:15 PM, Josh A wrote:
> Hi,
>
> For various DB Dialects(DB2,Oracle,MS-SQL & Postgres are the ones i am most interested in), Is there a way to influence
> Java type to DB Type mapping in Teneo?
> For example, is there a way to indicate to teneo to map a given EAttribute to a 'datetime2' type column in MS-SQL?
>
> I came across the following Hibernate annotation which looked promising @Type(type="timestamp"). However, i am not sure
> what is the equivalent for timestamp2 in this annotation?
>
> I guess the other option is to create a new hibernate UserType and map it via
> @Type(type="org.example.test.annotations.TimeStamp2Type")?
> Thanks for your help,
> Josh


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Cell: +31 (0)6 288 48 943
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@xxxxxxxx - mtaal@xxxxxxxx
Web: www.springsite.com - www.elver.org
Re: [Teneo] Recommended way to override Java to DB Type Mapping for various databases [message #916666 is a reply to message #916346] Wed, 19 September 2012 09:42 Go to previous messageGo to next message
Josh A is currently offline Josh AFriend
Messages: 13
Registered: September 2012
Junior Member
Thanks for your reply.

Your suggestion looks very promising. Let me investigate this in detail.
Re: [Teneo] Recommended way to override Java to DB Type Mapping for various databases [message #916840 is a reply to message #916346] Wed, 19 September 2012 14:38 Go to previous message
Josh A is currently offline Josh AFriend
Messages: 13
Registered: September 2012
Junior Member
Hi Martin,


Your solution worked beautifully! Thanks a ton!

Cheers,
Josh
Previous Topic:Docs and examples for EMF Fragment Paths?
Next Topic:[databinding] Data binding and read-only resources
Goto Forum:
  


Current Time: Thu Apr 18 13:00:08 GMT 2024

Powered by FUDForum. Page generated in 0.02090 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top