MCPcopy Create free account
hub / github.com/mikro-orm/mikro-orm / checkLockRequirements

Method checkLockRequirements

packages/core/src/EntityManager.ts:2718–2730  ·  view source on GitHub ↗
(mode: LockMode | undefined, meta: EntityMetadata)

Source from the content-addressed store, hash-verified

2716 }
2717
2718 private checkLockRequirements(mode: LockMode | undefined, meta: EntityMetadata): void {
2719 if (!mode) {
2720 return;
2721 }
2722
2723 if (mode === LockMode.OPTIMISTIC && !meta.versionProperty) {
2724 throw OptimisticLockError.notVersioned(meta);
2725 }
2726
2727 if ([LockMode.PESSIMISTIC_READ, LockMode.PESSIMISTIC_WRITE].includes(mode) && !this.isInTransaction()) {
2728 throw ValidationError.transactionRequired();
2729 }
2730 }
2731
2732 private validateIndexUsage<Entity extends object>(
2733 meta: EntityMetadata<Entity>,

Callers 1

findOneMethod · 0.80

Calls 3

isInTransactionMethod · 0.95
notVersionedMethod · 0.80
transactionRequiredMethod · 0.80

Tested by

no test coverage detected