-
Type:
Task
-
Resolution: Done
-
Priority:
Major - P3
-
None
The first ticket to map Bson-specific Java type to MongoDB data type, with JDBC type as the intermediary.
Ideally an elegant and extensible way is to be found so in the future other Bson type mapping would boil down to some pattern repetition.
The goal is to map the id field with org.bson.types.ObjectId type in the following entity class as expected:
import org.bson.types.ObjectId; @Entity @Table(name = "books") class Book { @Id ObjectId id; ... ... }
For instance, the following insertion processing
sessionFactory.inTransaction(session -> { var book = new Book(); book.id = ObjectId.get(); ... ... session.persist(book); });
might end up with the following MQL issued:
{"insert": "books", "documents": [{..., "_id": {"$oid": "67d485d19faedd225f55b64e"}}]}
Complete CRUD integration testings are desired (loading by primary key could be delayed if not done).
- has to be done after
-
HIBERNATE-22 implement load MQL translation
-
- Closed
-
- is depended on by
-
HIBERNATE-24 ObjectId generator
-
- Closed
-
- links to