public class JpaCustomizedUserRepository<D extends JpaUser> extends Object implements CustomizedUserRepository<D>
Constructor and Description |
---|
JpaCustomizedUserRepository() |
Modifier and Type | Method and Description |
---|---|
protected javax.persistence.criteria.Predicate |
buildIdFilter(String entityId,
javax.persistence.criteria.Root<D> userEntity,
javax.persistence.criteria.CriteriaBuilder criteriaBuilder,
Map<String,Object> parameterValues) |
Class<D> |
getDomainType() |
protected UserRepository<D> |
getUserRepository() |
D |
replaceOnlyIfLastUpdatedBefore(@NonNull String entityId,
D user,
@NonNull Instant lastUpdated)
A specialized replace operation that does not invoke the "save" create-or-update behavior.
|
void |
setRepository(UserRepository<D> repository) |
@Autowired public void setRepository(UserRepository<D> repository)
public Class<D> getDomainType()
getDomainType
in interface com.broadleafcommerce.common.extension.DomainTypeAware
@Nullable @Transactional public D replaceOnlyIfLastUpdatedBefore(@NonNull @NonNull String entityId, @NonNull D user, @NonNull @NonNull Instant lastUpdated)
CustomizedUserRepository
This is intended to be used in concurrent scenarios where only one operation should succeed.
Note that this update should succeed even if the existing record is
User.archived
.
Note that this method should also set the provided User.archived
value, even
if it is true
.
replaceOnlyIfLastUpdatedBefore
in interface CustomizedUserRepository<D extends JpaUser>
entityId
- the id of the entity to replaceuser
- the replacement entitylastUpdated
- the timestamp of the current change. This will be compared to the
lastUpdated on the existing entity for determination of whether the replacement should
occur. Furthermore, the replacement will have its User.lastUpdated
set to this
value.null
if the entity
was not found or could not be updated due to its lastUpdated value.protected javax.persistence.criteria.Predicate buildIdFilter(String entityId, javax.persistence.criteria.Root<D> userEntity, javax.persistence.criteria.CriteriaBuilder criteriaBuilder, Map<String,Object> parameterValues)
protected UserRepository<D> getUserRepository()
Copyright © 2021. All rights reserved.