18 lines
763 B
Kotlin
18 lines
763 B
Kotlin
package com.android.trisolarisserver.repo
|
|
|
|
import com.android.trisolarisserver.models.room.PropertyCardCounter
|
|
import org.springframework.data.jpa.repository.JpaRepository
|
|
import org.springframework.data.jpa.repository.Lock
|
|
import org.springframework.data.jpa.repository.Query
|
|
import org.springframework.data.repository.query.Param
|
|
import java.util.UUID
|
|
import jakarta.persistence.LockModeType
|
|
|
|
interface PropertyCardCounterRepo : JpaRepository<PropertyCardCounter, UUID> {
|
|
fun findByPropertyId(propertyId: UUID): PropertyCardCounter?
|
|
|
|
@Lock(LockModeType.PESSIMISTIC_WRITE)
|
|
@Query("select c from PropertyCardCounter c where c.property.id = :propertyId")
|
|
fun findByPropertyIdForUpdate(@Param("propertyId") propertyId: UUID): PropertyCardCounter?
|
|
}
|