test #449
+37
@@ -0,0 +1,37 @@
|
|||||||
|
package kr.co.vividnext.sodalive.v2.creator.channel.community.translation.adapter.out.persistence
|
||||||
|
|
||||||
|
import kr.co.vividnext.sodalive.common.BaseEntity
|
||||||
|
import javax.persistence.Column
|
||||||
|
import javax.persistence.Entity
|
||||||
|
import javax.persistence.Table
|
||||||
|
import javax.persistence.UniqueConstraint
|
||||||
|
|
||||||
|
@Entity
|
||||||
|
@Table(
|
||||||
|
name = "creator_community_translation",
|
||||||
|
uniqueConstraints = [
|
||||||
|
UniqueConstraint(
|
||||||
|
name = "uk_creator_community_translation_post_locale",
|
||||||
|
columnNames = ["creator_community_id", "locale"]
|
||||||
|
)
|
||||||
|
]
|
||||||
|
)
|
||||||
|
class CreatorCommunityTranslation(
|
||||||
|
@Column(name = "creator_community_id", nullable = false)
|
||||||
|
val creatorCommunityId: Long,
|
||||||
|
|
||||||
|
@Column(nullable = false, length = 10)
|
||||||
|
val locale: String,
|
||||||
|
|
||||||
|
@Column(nullable = false, columnDefinition = "text")
|
||||||
|
var content: String,
|
||||||
|
|
||||||
|
@Column(name = "source_revision", nullable = false)
|
||||||
|
var sourceRevision: Long,
|
||||||
|
|
||||||
|
@Column(name = "source_hash", nullable = false, length = 64)
|
||||||
|
var sourceHash: String,
|
||||||
|
|
||||||
|
@Column(name = "source_language", nullable = false, length = 10)
|
||||||
|
var sourceLanguage: String
|
||||||
|
) : BaseEntity()
|
||||||
+26
@@ -0,0 +1,26 @@
|
|||||||
|
package kr.co.vividnext.sodalive.v2.creator.channel.community.translation.adapter.out.persistence
|
||||||
|
|
||||||
|
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 javax.persistence.LockModeType
|
||||||
|
|
||||||
|
interface CreatorCommunityTranslationRepository : JpaRepository<CreatorCommunityTranslation, Long> {
|
||||||
|
fun findByCreatorCommunityIdAndLocale(creatorCommunityId: Long, locale: String): CreatorCommunityTranslation?
|
||||||
|
|
||||||
|
@Lock(LockModeType.PESSIMISTIC_WRITE)
|
||||||
|
@Query(
|
||||||
|
"select t from CreatorCommunityTranslation t " +
|
||||||
|
"where t.creatorCommunityId = :creatorCommunityId and t.locale = :locale"
|
||||||
|
)
|
||||||
|
fun findByCreatorCommunityIdAndLocaleForUpdate(
|
||||||
|
@Param("creatorCommunityId") creatorCommunityId: Long,
|
||||||
|
@Param("locale") locale: String
|
||||||
|
): CreatorCommunityTranslation?
|
||||||
|
|
||||||
|
fun findByCreatorCommunityIdInAndLocale(
|
||||||
|
creatorCommunityIds: Collection<Long>,
|
||||||
|
locale: String
|
||||||
|
): List<CreatorCommunityTranslation>
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user