Persisting Resources in SQL Database
You can change the default location of where your resources are persisted.
Prerequisites
- Hibernate access pointing to an SQL database
- metamodel attached to your access must have
ResourceModel
as a dependency
Persisting Resources in an SQL Database
-
Create an instance of the
SqlBinaryProcessor
, and attach the SQL connection that points to your SQL database to theconnectionPool
property.You can also choose to overwrite the default
tableMapping
if you want to use custom table names. -
Create an instance of the
UploadWith
metadata and attach your instance of theSqlBinaryProcessor
to thepersistence
property. Click Apply and Commit. -
Create an instance of the
StreamWith
metadata and attach your instance of theSqlBinaryProcessor
to theretrieval
property. Click Apply and Commit. -
Navigate to Custom Models and select the model bound to your Hibernate access. Go to Type Overrides and create a new
GmEntityTypeOverride
instance. -
Set the
declaringModel
property toResourceModel
,entityType
toResourceSource
, and add yourUploadWith
metadata instance (the one where you attached theSqlBinaryProcessor
to thepersistence
property) to themetaData
list. Click Apply and finish, then Apply and then Commit. -
Still in the model bound to your Hibernate access, create a
GmEntityTypeOverride
instance. -
Set the
declaringModel
property toResourceModel
,entityType
toSQLSource
, and add yourStreamWith
metadata instance (the one where you attached theSqlBinaryProcessor
to theretrieval
property) to themetaData
list. Click Apply and finish, then Apply and then Commit.