How does Gen handle 'Time' domain attributes in Oracle
search cancel

How does Gen handle 'Time' domain attributes in Oracle

book

Article ID: 392209

calendar_today

Updated On: 04-01-2025

Products

Gen

Issue/Introduction

Migrating from DB2 to Oracle.
DB2 has data types of DATE, TIME TIMESTAMP.
Oracle only has a data type of DATE.

How does Gen implement and work with Entity attributes which have domain 'Time' in Oracle?
Does the generated code handle all of the conversions needed to view and work with the data in a 'Time' and then store the Time portion in the DATE column?

 

Environment

Gen 8.6

Resolution

In Gen when targeting the Oracle database, Date, Time and Timestamp attributes in a Gen model are implemented as an Oracle DATE data type column.

The processing of each of the 3 attribute types is handled in the code.

For C generated code:
This contains Oracle specific embedded SQL statements which use Oracle TO_DATE and TO_CHAR functions to process the data in the correct format for the required Gen attribute domain.
 
For C#/.NET or Java generated code:
These does not generate database-specific code and instead use functions to process the data according to the Gen attribute domain e.g. for generated C# code functions DateAttr.ValueOf, TimeAttr.ValueOf, TimestampAttr.ValueOf are used.

For the example for a Time attribute, the date portion of the field is stored as '01-Jan-01' (Oracle null date) and only the Time portion of the data is processed.