diff --git a/src/main/java/com/mongodb/hibernate/dialect/MongoDialect.java b/src/main/java/com/mongodb/hibernate/dialect/MongoDialect.java index f6c1db3b..d126a3de 100644 --- a/src/main/java/com/mongodb/hibernate/dialect/MongoDialect.java +++ b/src/main/java/com/mongodb/hibernate/dialect/MongoDialect.java @@ -31,11 +31,15 @@ import com.mongodb.hibernate.internal.type.ObjectIdJavaType; import com.mongodb.hibernate.internal.type.ObjectIdJdbcType; import com.mongodb.hibernate.jdbc.MongoConnectionProvider; +import java.math.BigDecimal; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.Timestamp; import java.time.Instant; import java.util.Calendar; +import java.util.Collection; +import org.bson.types.ObjectId; +import org.hibernate.annotations.Struct; import org.hibernate.boot.model.FunctionContributions; import org.hibernate.boot.model.TypeContributions; import org.hibernate.cfg.AvailableSettings; @@ -55,6 +59,7 @@ import org.hibernate.sql.model.internal.OptionalTableUpdate; import org.hibernate.sql.model.jdbc.OptionalTableUpdateOperation; import org.hibernate.type.SqlTypes; +import org.hibernate.type.WrapperArrayHandling; import org.hibernate.type.descriptor.jdbc.TimestampUtcAsInstantJdbcType; import org.hibernate.type.descriptor.sql.internal.DdlTypeImpl; import org.jspecify.annotations.Nullable; @@ -68,6 +73,79 @@ * creating a JDBC adaptor on top of MongoDB Java * Driver. * + *
| Java type | + *BSON type | + *
|---|---|
| null type | + *BSON {@code Null} | + *
| {@code byte[]} | + *BSON {@code Binary data} with subtype 0 | + *
| {@code char}, {@link Character}, {@link String}, {@code char[]} | + *BSON {@code String} | + *
| {@code int}, {@link Integer} | + *BSON {@code 32-bit integer} | + *
| {@code long}, {@link Long} | + *BSON {@code 64-bit integer} | + *
| {@code double}, {@link Double} | + *BSON {@code Double} | + *
| {@code boolean}, {@link Boolean} | + *BSON {@code Boolean} | + *
| {@link BigDecimal} | + *BSON {@code Decimal128} | + *
| {@link ObjectId} | + *BSON {@code ObjectId} | + *
| {@link Instant} | + *BSON {@code Date} | + *
| {@link Struct} aggregate embeddable | + *
+ * BSON {@code Object}
+ *
+ * Field values are mapped as per this table. + * |
+ *
|
+ * array, {@link Collection} (or a subtype supported by Hibernate ORM),
+ * except for {@code byte[]}, {@code char[]}
+ *
+ * Note that {@link Character}{@code []} requires setting {@value AvailableSettings#WRAPPER_ARRAY_HANDLING} to {@link WrapperArrayHandling#ALLOW}. + * |
+ *
+ * BSON {@code Array}
+ *
+ * Array elements are mapped as per this table. + * |
+ *
For the documentation on the supported HQL * functions see {@link #initializeFunctionRegistry(FunctionContributions)}. @@ -248,7 +326,7 @@ public boolean supportsStandardArrays() { * *