Skip to content

Extended Configuration

Martin Ledvinka edited this page May 30, 2025 · 4 revisions

Besides the basic required configuration, JOPA provides additional configuration parameters that can be used to customize the library behavior. Most of the parameters can be found in the JOPAPersistenceProperties class.

Persistence Unit-level

Persistence unit-level configuration is passed to Persistence when creating an EntityManagerFactory as a Map.

Property Description
cz.cvut.jopa.lang Default language for saving/loading strings. If not set, String attribute values are stored as RDF simple literals, i.e., strings without language tag.
cz.cvut.jopa.cache.enable Whether the second level cache should be used. Defaults to true .
cz.cvut.jopa.scanPackage Where the entity classes are located.
cz.cvut.jopa.cache.ttl Cached entity time to live for the TTL cache implementation. In seconds.
cz.cvut.jopa.cache.sweepRate How often should the cache be swept for dead entities. In seconds.
cz.cvut.jopa.cache.type Type of the second level cache. Currently supported are ttl (time-to-live, TTL) and lru (least-recently-used, LRU). Defaults to LRU.
cz.cvut.jopa.cache.lru.capacity Capacity of the LRU second level cache.
cz.cvut.jopa.ic.validation.disableOnLoad Disable integrity constraints validation on entity/field load. Useful for working with legacy/external data.
cz.cvut.jopa.preferMultilingualString Indicates whether JOPA should prefer MultilingualString over String when target type is unclear from context. For example, when a field is of type Object and the value is language-tagged string, this setting will influence the actual type set on the field.
cz.cvut.jopa.classpathScanner Name of a custom cz.cvut.kbss.jopa.loaders.ClasspathScanner implementation used to discover entity classes. The specified class must have a public no-arg constructor.
cz.cvut.kbss.jopa.ignoreInferredValueRemovalOnMerge Ignores removal of inferred values when entity state is merged into the persistence context. Normally, attempts to remove inferred values lead to an cz.cvut.kbss.jopa.exceptions.InferredAttributeModifiedException. But when an entity is merged into the persistence context, it may be merged without inferred attribute values because they were not accessible to the client application. Instead of requiring the application to reconstruct them, this configuration allows to ignore such changes completely.
cz.cvut.kbss.jopa.changeTrackingMode Whether changes to entities are to be registered immediately (IMMEDIATE) or calculated on commit (ON_COMMIT). Calculating changes immediately requires JOPA to use generated proxy classes. The on-commit change tracking is the default for the RDF4J driver, immediate is the default for Jena and OWLAPI driver. See the change tracking wiki entry for details.

Persistence Context-level

Persistence context-level configuration is passed to EntityManagerFactory when creating EntityManager instances.

Property Description
cz.cvut.kbss.jopa.transactionMode Whether the entity manager should be created in read-write (default) or read-only (pass read_only) mode. Note that this configuration applies to all transactions run from the created entity manager. Read-only transaction mode performs some optimizations such as not creating clones of objects. Data modification operations are forbidden in this mode.
Clone this wiki locally