#HQFramework: ItemStack.toExposedBlob 이슈

1 messages · Page 1 of 1 (latest)

royal shard
#

소스코드:

try {
    return categoryRepository.new {
      this.name = categoryName
      this.displayItem = displayItem.toExposedBlob()
    }.toCategory()
} catch (e: EOFException) {
    println("EOFException occurred while converting ItemStack to Blob: ${e.message}")
    e.printStackTrace()
    return null
}

테스트 버전: 1.21.4
테스트 아이템: 종이

narrow cypress
royal shard
narrow cypress
#

음.. 그럼 꽁플님이 보셔야 할 문제네염

royal shard
#

@coarse venture

coarse venture
#

displayItem 타입이 먼가영 ?

royal shard
coarse venture
#

엄 근데

#

오류가 저기서 나는게 아닌것같아보이는데

#

toItemStack <-- 여기서 찍힌것같은데

royal shard
# coarse venture toItemStack <-- 여기서 찍힌것같은데

흠....

class CookingCategoryEntity(id: EntityID<Int>) : IntEntity(id) {
    companion object : IntEntityClass<CookingCategoryEntity>(CookingCategoryTable)

    var name by CookingCategoryTable.name
    var displayItem by CookingCategoryTable.displayItem

    fun toCategory(): Category {
        return Category(name, displayItem.toItemStack())
    }
}

@Table
object CookingCategoryTable : IntIdTable("tb_cooking_category") {
    val name = varchar("name", 20)
    val displayItem = itemStack("display_item")
}
coarse venture
#

toCategory() 에서

#

displayItem.toItemStack 할 때

#

exception 이 있네영

#
try {
    categoryRepository.new {
      this.name = categoryName
      this.displayItem = displayItem.toExposedBlob()
    }

    return Category(name, displayItem)
} catch (e: EOFException) {
    println("EOFException occurred while converting ItemStack to Blob: ${e.message}")
    e.printStackTrace()
    return null
}
#

으로 하거나

#

저장후에

#

새로운 트랜잭션에서 read 하셔야할듯여

royal shard
# coarse venture 새로운 트랜잭션에서 read 하셔야할듯여
override suspend fun createByName(categoryName: String, displayItem: ItemStack): Category {
    categoryRepository.new {
        this.name = categoryName
        this.displayItem = displayItem.toExposedBlob()
    }
    return Category(categoryName, displayItem)
}

이렇게 바꿔주니깐 모든 이슈가 해결 됐네요 감사합니다

  • toItemStack 메서드도 문제 없이 동작합니다