I've an application which stores entites in MariaDB. The entity has some relations to other entities and in one of the child entities is a binary attribute. See the following:
Parent
\ 1-n ChildA
- attrA1
- ...
\ 1-n ChildB
- attrB1
- binaryAttr
Storing the binary files in the DB has an impact on the DB size of course and thereby an impact on our backup concept. Besides this binary data doesn't necessarily have to be in the DB as well.
I'm thinking about combining MariaDB with an S3 compatible object store, so that the structured data is persisted in DB and the binary files in the object store.
We're are using Spring Boot (Data-JPA) with Apache Camel.
The naïve approach would be to store the binary file with a uuid-key in the object store and afterwards persisting the rest of the entity with the reference (uuid) to the DB. But there's no easy transaction handling for this, nor a transparent handling of the entity (I've to handle persisting entity and binary data seperately).
- Is there a java / spring based framework to overcome the drawbacks (transaction handling, transparent handling) of two different "datasources"?
- What is the best practice to handle such a scenario or is it totally unrecommended?
- Is there an extension mechanism for Spring / Hibernate to handle object store persistency within the hibernate orm mapping process?
- Is it possible to implement one repository for persisting / loading entity and binary data at once?
Can anyone give me some direction?