-
Type:
Task
-
Resolution: Unresolved
-
Priority:
Minor - P4
-
None
-
None
-
None
-
None
-
None
-
None
-
None
It is of importance to do this ticket before making the product available to the public.
All the types in the org.bson.types package are Serializable. This means:
- "Jakarta Persistence’s support for Serializable types is to directly serialize their state to the database"
- "Worst case, if the Java type is Serializable Hibernate will try to handle it via binary serialization."
- "In cases when the Java type specified for the "database side" of the conversion (the second AttributeConverter bind parameter) is not known, Hibernate will fallback to a java.io.Serializable type."
Thus, without us doing anything, Hibernate ORM stores values of those types using PreparedStatement.setBytes, where the bytes are the serialized value. This is not how we want these values to be stored. Given that the types "work" even now, if we don't do anything, and introduce proper support for these types after the product is first made available to the public, then such a change would be breaking. Therefore, before making the product available to the public, we should either explicitly support all of the types in org.bson.types, or explicitly forbid them. The latter is likely simpler, but still requires us to create and register with Hibernate ORM custom org.hibernate.type.descriptor.java.JavaType and/or org.hibernate.type.descriptor.jdbc.JdbcType for each of the types from org.bson.types.