My entities contain a timestamp
attribute that is getting converted to a LocalDateTime
as the docs specify. However, I would like to convert the timestamp
into an OffsetDateTime
. Is there any way to override the default conversion behavior?
This question mentions a .dbrep, but I don't have such a file in my project.
You can't override the default conversion behavior,
but you can change the type in the templates (.vm files) using Velocity language.
#if ( $attribute.neutralType == 'timestamp' )
#set ($mytype = 'OffsetDateTime')
#else
#set ($mytype = $attribute.simpleType )
#end
if this operation must be repeated in several templates you can define a macro
myField : timestamp { #tagetType(OffsetDateTime) } ;
$attribute.tagValue( 'targetType', $attribute.simpleType )
In both cases, do not forget to import 'java.time.OffsetDateTime'