Package com.axelor.db
Class JpaRepository<T extends Model>
java.lang.Object
com.axelor.db.JpaRepository<T>
- Type Parameters:
T- the type of bean class
- All Implemented Interfaces:
Repository<T>
- Direct Known Subclasses:
AbstractMetaJsonModelRepository,AbstractMFARepository,AbstractUserRepository,AbstractUserTokenRepository,DMSFileRepository,DMSFileTagRepository,DMSPermissionRepository,GroupRepository,MailAddressRepository,MailFlagsRepository,MailFollowerRepository,MailMessageRepository,MetaActionMenuRepository,MetaActionRepository,MetaAttachmentRepository,MetaAttrsRepository,MetaEnumRepository,MetaFieldRepository,MetaFileRepository,MetaFilterRepository,MetaHelpRepository,MetaJsonFieldRepository,MetaJsonRecordRepository,MetaMenuRepository,MetaModelRepository,MetaModuleRepository,MetaPermissionRepository,MetaPermissionRuleRepository,MetaScheduleParamRepository,MetaScheduleRepository,MetaSelectItemRepository,MetaSelectRepository,MetaSequenceRepository,MetaThemeRepository,MetaTranslationRepository,MetaViewCustomRepository,MetaViewRepository,PasswordResetTokenRepository,PermissionRepository,RoleRepository,TeamRepository,TeamTaskRepository,TeamTopicRepository
The JPA implementation of the
Repository.-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionall()Get theQueryinstance of the managed domain class.Get theQueryinstance of the given type.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.voidflush()Synchronize the persistence context to the underlying database.Merge the state of the given entity into the current persistence context.static <U extends Model>
JpaRepository<U> voidMake an entity managed and persistent.Populate the given json map with additional data.voidRefresh the state of the instance from the database, overwriting changes made to the entity, if any.voidRemove the given entity.Save the given entity.Validate the given json map before persisting.
-
Field Details
-
modelClass
-
-
Constructor Details
-
JpaRepository
-
-
Method Details
-
fields
Description copied from interface:RepositoryReturn list of properties on the domain model managed by this repository.- Specified by:
fieldsin interfaceRepository<T extends Model>- Returns:
- list of
Property
-
all
Description copied from interface:RepositoryGet theQueryinstance of the managed domain class.- Specified by:
allin interfaceRepository<T extends Model>- Returns:
- instance of
Query
-
all
Get theQueryinstance of the given type.- Type Parameters:
U- type of the model class- Parameters:
type- the subtype of the managed model class.- Returns:
- instance of
Query
-
create
Description copied from interface:RepositoryCreate a new instance of the domain model with the given default values.- Specified by:
createin interfaceRepository<T extends Model>- Parameters:
values- the default values- Returns:
- an instance of the domain model managed by this repository
-
copy
Description copied from interface:RepositoryCreate 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.- Specified by:
copyin interfaceRepository<T extends Model>- Parameters:
entity- the entity bean to copydeep- whether to create a deep copy- Returns:
- a copy of the given entity
-
find
Description copied from interface:RepositoryFind by primary key.- Specified by:
findin interfaceRepository<T extends Model>- Parameters:
id- the record id- Returns:
- a domain object found by the given id, null otherwise
-
findByIds
Description copied from interface:RepositoryFind multiple entities by their primary key.- Specified by:
findByIdsin interfaceRepository<T extends Model>- Parameters:
ids- The ids to load- Returns:
- list of all the matched records
-
save
Description copied from interface:RepositorySave 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:
savein interfaceRepository<T extends Model>- Parameters:
entity- the entity object to save- Returns:
- an instance of the entity with saved state
-
persist
Make an entity managed and persistent.- Parameters:
entity- the entity instance- See Also:
-
merge
Merge the state of the given entity into the current persistence context.- Parameters:
entity- the entity instance- Returns:
- the managed instance
- See Also:
-
remove
Description copied from interface:RepositoryRemove the given entity.- Specified by:
removein interfaceRepository<T extends Model>- Parameters:
entity- the entity object
-
refresh
Refresh the state of the instance from the database, overwriting changes made to the entity, if any.- Specified by:
refreshin interfaceRepository<T extends Model>- Parameters:
entity- the entity instance- See Also:
-
flush
public void flush()Synchronize the persistence context to the underlying database.- Specified by:
flushin interfaceRepository<T extends Model>- See Also:
-
validate
Description copied from interface:RepositoryValidate the given json map before persisting.This method is called before the json map is converted to model object.
- Specified by:
validatein interfaceRepository<T extends Model>- Parameters:
json- the json map to validatecontext- the context- Returns:
- validated json map
-
populate
Description copied from interface:RepositoryPopulate the given json map with additional data.This method is called before returning the json data as response.
- Specified by:
populatein interfaceRepository<T extends Model>- Parameters:
json- the json map to populatecontext- the context- Returns:
- the json map itself
-
of
-