Navigation :
test ../../../ test dev.html
Developer Guide
test ../../../ test dev/dev-release.html
-
Release and migration notes
test ../../../ test dev/getting-started.html
-
Getting started
test ../../../ test dev/dev-ui-config.html
-
Configuring the UI
test ../../../ test dev/dev-extensions.html
-
Extending the Module
test ../../../ test dev/dev-extensions/custom-cube-config.html
--
Adding Custom Cube Configuration
test ../../../ test dev/dev-extensions/custom-data-loading.html
--
Adding Custom Data Loading
test ../../../ test dev/dev-extensions/custom-evaluation.html
--
Adding Custom Evaluation Logic
test ../../../ test dev/dev-extensions/custom-limit-structure-templates.html
-- Adding Custom Limit Structure Templates
test ../../../ test dev/dev-extensions/custom-ui-exceptions.html
-- Adding Custom UI Exceptions
test ../../../ test dev/dev-extensions/custom-utilization.html
-- Adding Custom Utilization
test ../../../ test dev/dev-extensions/custom-validation.html
--
Adding Custom Validation
test ../../../ test dev/dev-extensions/custom-workflow.html
--
Adding Custom Workflow Tasks
test ../../../ test dev/dev-extensions/custom-persistence.html
--
Adding Custom Persistence
test ../../../ test dev/dev-extensions/custom-persistence/custom-managed-objects.html
--- Adding Managed Objects
test ../../../ test dev/dev-extensions/custom-persistence/custom-crud-services.html
--- Adding Custom CRUD Services
test ../../../ test dev/dev-extensions/custom-persistence/custom-persistence-services.html
--- Adding Custom Persistence Services
test ../../../ test dev/dev-extensions/custom-persistence/multiple-external-databases.html
--- Using Multiple Databases
test ../../../ test dev/integration.html
-
How to Connect Limits to an Atoti Server
test ../../../ test dev/persistence.html
-
Persistence
test ../../../ test dev/alert-tasks.html
-
Evaluating Limits
test ../../../ test dev/scopes.html
-
Limit Scopes
test ../../../ test dev/limit-workflow.html
-
Limit Workflow
test ../../../ test dev/date-roll.html
- Date Roll
test ../../../ test dev/restful-endpoint.html
- RESTful endpoints
test ../../../ test dev/security.html
- Required Roles
test ../../../ test user-ref.html
User & Reference Guide
test ../../../ test user-ref/limits-overview.html
-
Atoti Limits Overview
test ../../../ test user-ref/whats-new.html
- What's New
test ../../../ test user-ref/videos.html
- Video walk-throughs
test ../../../ test user-ref/using-limits.html
-
Manage limits
test ../../../ test user-ref/manage-incidents.html
-
Manage incidents
test ../../../ test user-ref/input-files.html
-
Input file formats
test ../../../ test user-ref/cube.html
-
Cube reference
test ../../../ test user-ref/properties.html
-
Properties
test ../../../ test user-ref/datastore.html
-
Datastores
Adding Managed Objects
Overview
You can set up Atoti Limits to manage custom objects with same EntityManager
as the out-of-the-box objects . Here’s how to do it:
1. Create the Entity
Define the entity class that will be managed by the EntityManager
. This class should
be annotated with @Entity
and @Table
to be recognized as a JPA entity.
For example, the entity may look as follows:
package com.activeviam.limits.model.custom.jpa;
@Entity
@Table ( name = "my_custom_entity" )
public class MyCustomEntity {
@Id
@Column ( name = "id" )
protected String id;
@Column ( name = "name" )
protected String name;
}
2. Create a JPA Repository
Create the JpaRepository
for the entity. This could be as simple as:
public interface MyCustomJpaRepo extends JpaRepository< MyCustomEntity, String> {
}
3. Import the JPA Repository
Create and import a Spring configuration class that imports the JpaRepository
for the
entity and uses the same EntityManager
as the default managed objects, for example:
@EnableJpaRepositories (
entityManagerFactoryRef = LimitsJpaConfig. LIMITS_ENTITY_MANAGER_FACTORY ,
transactionManagerRef = LimitsJpaConfig. LIMITS_TRANSACTION_MANAGER ,
basePackageClasses = {
MyCustomJpaRepo. class ,
})
public class MyCustomJpaConfig {
}
4. Scan for the Entity
In order to be managed by the same entity manager as the out-of-the-box objects, the entity package
must be added to the list of packages picked up by the limits.data.jpa.repository.packages-to-scan
configuration property. The default value for this property is com.activeviam.limits.model.jpa
, so
in the case of MyCustomEntity
above, the new property would be:
limits :
data :
jpa :
repository :
packages-to-scan : com.activeviam.limits.model.jpa, com.activeviam.limits.model.custom.jpa