Package com.axelor.meta.db.repo
Class MetaJsonRecordRepository
- All Implemented Interfaces:
Repository<MetaJsonRecord>
Repository implementation to handle custom model records.
-
Nested Class Summary
Nested Classes -
Field Summary
Fields inherited from class com.axelor.db.JpaRepository
modelClass
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionCreate aQuery
for the given json model.create
(MetaJsonRecord record) Create aContext
for the given json model to seamlessly work with json fields.Create a newMetaJsonRecord
for the given json model with given values.save
(MetaJsonRecord entity) Save the given entity.Save the json record backed by the given context.
-
Constructor Details
-
MetaJsonRecordRepository
public MetaJsonRecordRepository()Create new instance of theMetaJsonRecordRepository
.
-
-
Method Details
-
create
Create aContext
for the given json model to seamlessly work with json fields.For example:
Context person = repo.create("Person"); person.put("name", "Some NAME"); person.put("email", "some.name@gmail.com"); MetaJsonRecord saved = repo.save(person);
- Parameters:
jsonModel
- the name of the json model- Returns:
- a
Context
-
create
-
create
Create a newMetaJsonRecord
for the given json model with given values.- Parameters:
jsonModel
- the name of the json modelvalues
- the values to set- Returns:
- a new unsaved instance of
MetaJsonRecord
-
save
Save the json record backed by the given context.- Parameters:
context
- the json record context- Returns:
- saved instance
MetaJsonRecord
-
save
Description copied from interface:Repository
Save the given entity.Depending on the implementation, it may return same entity or a copy of it. For example JPA implementation may return a copy if the given entity can't be managed.
- Specified by:
save
in interfaceRepository<MetaJsonRecord>
- Overrides:
save
in classJpaRepository<MetaJsonRecord>
- Parameters:
entity
- the entity object to save- Returns:
- an instance of the entity with saved state
-
all
Create aQuery
for the given json model.- Parameters:
jsonModel
- name of the json model- Returns:
- an instance of
MetaJsonRecordRepository.MetaJsonRecordQuery
-