Skip to content

Commit

Permalink
Add a note on JsonFormat annotation and ORM FormatMapper
Browse files Browse the repository at this point in the history
  • Loading branch information
marko-bekhta committed Sep 12, 2024
1 parent 74ef7b3 commit a1c4c20
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions docs/src/main/asciidoc/hibernate-orm.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -1395,6 +1395,9 @@ and annotating the implementation with the appropriate qualifiers:

[source,java]
----
import io.quarkus.hibernate.orm.JsonFormat;
import org.hibernate.type.format.FormatMapper;
@JsonFormat // <1>
@PersistenceUnitExtension // <2>
public class MyJsonFormatMapper implements FormatMapper { // <3>
Expand All @@ -1412,6 +1415,9 @@ public class MyJsonFormatMapper implements FormatMapper { // <3>
<1> Annotate the format mapper implementation with the `@JsonFormat` qualifier
to tell Quarkus that this mapper is specific to JSON serialization/deserialization.
+
WARNING: Make sure the Quarkus-specific `@io.quarkus.hibernate.orm.JsonFormat` annotation is used
and not the one from Jackson.
+
<2> Annotate the format mapper implementation with the `@PersistenceUnitExtension` qualifier
to tell Quarkus it should be used in the default persistence unit.
+
Expand All @@ -1422,6 +1428,9 @@ In case of a custom XML format mapper, a different CDI qualifier must be applied

[source,java]
----
import io.quarkus.hibernate.orm.XmlFormat;
import org.hibernate.type.format.FormatMapper;
@XmlFormat // <1>
@PersistenceUnitExtension // <2>
public class MyJsonFormatMapper implements FormatMapper { // <3>
Expand Down

0 comments on commit a1c4c20

Please sign in to comment.