Package com.axelor.db
Interface Repository<T extends Model>
- Type Parameters:
T
- the domain model type the repository manages
- All Known Implementing Classes:
AbstractMetaJsonModelRepository
,AbstractMFARepository
,AbstractUserRepository
,AbstractUserTokenRepository
,DMSFileRepository
,DMSFileTagRepository
,DMSPermissionRepository
,GroupRepository
,JpaRepository
,MailAddressRepository
,MailFlagsRepository
,MailFollowerRepository
,MailMessageRepository
,MetaActionMenuRepository
,MetaActionRepository
,MetaAttachmentRepository
,MetaAttrsRepository
,MetaEnumRepository
,MetaFieldRepository
,MetaFileRepository
,MetaFilterRepository
,MetaHelpRepository
,MetaJsonFieldRepository
,MetaJsonModelRepository
,MetaJsonRecordRepository
,MetaMenuRepository
,MetaModelRepository
,MetaModuleRepository
,MetaPermissionRepository
,MetaPermissionRuleRepository
,MetaScheduleParamRepository
,MetaScheduleRepository
,MetaSelectItemRepository
,MetaSelectRepository
,MetaSequenceRepository
,MetaThemeRepository
,MetaTranslationRepository
,MetaViewCustomRepository
,MetaViewRepository
,MFARepository
,PasswordResetTokenRepository
,PermissionRepository
,RoleRepository
,TeamRepository
,TeamTaskRepository
,TeamTopicRepository
,UserRepository
,UserTokenRepository
public interface Repository<T extends Model>
The repository interface defines common data access methods.
-
Method Summary
Modifier and TypeMethodDescriptionall()
Get theQuery
instance of the managed domain class.Create a duplicate copy of the given entity.
In case of deep copy, one-to-many records are duplicated.Create a new instance of the domain model with the given default values.fields()
Return list of properties on the domain model managed by this repository.Find by primary key.Find multiple entities by their primary key.void
flush()
Synchronize the persistence context to the underlying database.Populate the given json map with additional data.void
Refresh the state of the instance from the database, overwriting changes made to the entity, if any.void
Remove the given entity.Save the given entity.Validate the given json map before persisting.
-
Method Details
-
fields
Return list of properties on the domain model managed by this repository.- Returns:
- list of
Property
-
all
Get theQuery
instance of the managed domain class.- Returns:
- instance of
Query
-
create
Create a new instance of the domain model with the given default values.- Parameters:
values
- the default values- Returns:
- an instance of the domain model managed by this repository
-
copy
Create a duplicate copy of the given entity.
In case of deep copy, one-to-many records are duplicated. Otherwise, one-to-many records will be skipped.- Parameters:
entity
- the entity bean to copydeep
- whether to create a deep copy- Returns:
- a copy of the given entity
-
find
Find by primary key.- Parameters:
id
- the record id- Returns:
- a domain object found by the given id, null otherwise
-
findByIds
Find multiple entities by their primary key.- Parameters:
ids
- The ids to load- Returns:
- list of all the matched records
-
save
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.
- Parameters:
entity
- the entity object to save- Returns:
- an instance of the entity with saved state
-
remove
Remove the given entity.- Parameters:
entity
- the entity object
-
refresh
Refresh the state of the instance from the database, overwriting changes made to the entity, if any.- Parameters:
entity
- the entity object to refresh
-
flush
void flush()Synchronize the persistence context to the underlying database. -
validate
Validate the given json map before persisting.This method is called before the json map is converted to model object.
- Parameters:
json
- the json map to validatecontext
- the context- Returns:
- validated json map
-
populate
Populate the given json map with additional data.This method is called before returning the json data as response.
- Parameters:
json
- the json map to populatecontext
- the context- Returns:
- the json map itself
-