diff --git a/hibernate-types-52/src/main/java/com/vladmihalcea/hibernate/type/HibernateTypesContributor.java b/hibernate-types-52/src/main/java/com/vladmihalcea/hibernate/type/HibernateTypesContributor.java index fc645a65e..3a405971c 100644 --- a/hibernate-types-52/src/main/java/com/vladmihalcea/hibernate/type/HibernateTypesContributor.java +++ b/hibernate-types-52/src/main/java/com/vladmihalcea/hibernate/type/HibernateTypesContributor.java @@ -94,9 +94,12 @@ public void contribute(TypeContributions typeContributions, ServiceRegistry serv .contributeType(typeContributions, YearMonthEpochType.INSTANCE) .contributeType(typeContributions, YearMonthIntegerType.INSTANCE) .contributeType(typeContributions, YearMonthTimestampType.INSTANCE) - .contributeType(typeContributions, MonetaryAmountType.INSTANCE) /* JSON */ .contributeType(typeContributions, JsonType.INSTANCE); + /* Money and Currency API */ + if(ReflectionUtils.getClassOrNull("org.javamoney.moneta.Money") != null) { + this.contributeType(typeContributions, MonetaryAmountType.INSTANCE); + } } private HibernateTypesContributor contributeType(TypeContributions typeContributions, Object type) { diff --git a/hibernate-types-55/src/main/java/com/vladmihalcea/hibernate/type/HibernateTypesContributor.java b/hibernate-types-55/src/main/java/com/vladmihalcea/hibernate/type/HibernateTypesContributor.java index fc645a65e..3a405971c 100644 --- a/hibernate-types-55/src/main/java/com/vladmihalcea/hibernate/type/HibernateTypesContributor.java +++ b/hibernate-types-55/src/main/java/com/vladmihalcea/hibernate/type/HibernateTypesContributor.java @@ -94,9 +94,12 @@ public void contribute(TypeContributions typeContributions, ServiceRegistry serv .contributeType(typeContributions, YearMonthEpochType.INSTANCE) .contributeType(typeContributions, YearMonthIntegerType.INSTANCE) .contributeType(typeContributions, YearMonthTimestampType.INSTANCE) - .contributeType(typeContributions, MonetaryAmountType.INSTANCE) /* JSON */ .contributeType(typeContributions, JsonType.INSTANCE); + /* Money and Currency API */ + if(ReflectionUtils.getClassOrNull("org.javamoney.moneta.Money") != null) { + this.contributeType(typeContributions, MonetaryAmountType.INSTANCE); + } } private HibernateTypesContributor contributeType(TypeContributions typeContributions, Object type) {