HOw can I ovverride the @Type annotation on orm.xml?
FOr example I Would like to set at orm.xml the @Type(JsonType.class)
Because in some database this will change
HOw can I ovverride the @Type annotation on orm.xml?
FOr example I Would like to set at orm.xml the @Type(JsonType.class)
Because in some database this will change
Why would you want to do that? Hibernate ORM 6 comes with JSON support out of the box and uses the best matching underlying SQL type. Just annotate your attribute with @JdbcTypeCode(SqlTypes.JSON)
.
Hi @beikov , tks for your reply
Because Oracle 19c do not support Json Column,
I Used a blob column to store the json, for that I use the annotation
Type(JsonType.class) of io.hypersistence.utils.hibernate.type.json.JsonType
With Column(columnDefinition = “BLOB CONSTRAINT JSON_WRFLDEF_WRFL CHECK (WORKFLOW IS JSON)”)
But I have another database Oracle 21, that supports Json Column
This JdbcTypeCode(SqlTypes.JSON) Will work with blob column with json content too?
If not I need to set on orm.xml for oracle 19c the type io.hypersistence.utils.hibernate.type.json.JsonType, and column definition
Hibernate ORM will use the blob type automatically, you can just annotate @JdbcTypeCode(SqlTypes.JSON)
.
Perfect, It Worked very well
Thank you very much
ON more question, is possible to override on orm.xml the @type annotation if needed? I search , and I do not find
You can use Hibernates mapping XSD, which is a drop-in replacement for the JPA orm.xml XSD, but comes with extensions: https://hibernate.org/xsd/orm/mapping/mapping-3.1.0.xsd