我正在将我的 Quarkus 项目从经典的 Hibernate ORM 迁移到 Hibernate Reactive,并且遇到了 JSONB 字段映射的问题。
这是实体:
@Entity
@TypeDef(name = JsonTypes.JSON_BIN, typeClass = JsonBinaryType::class)
class MyEntity {
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "myEntityIdGenerator")
@SequenceGenerator(name = "myEntityIdGenerator", sequenceName = "my_entity_id_seq", allocationSize = 10)
var id: Long? = null
// Usage of a plain JsonNode instead of a mapped class is intentional,
// as the app receives a request with raw JSON data and should store it without any processing
@Type(type = JsonTypes.JSON_BIN)
@NotNull
lateinit var jsonData: …Run Code Online (Sandbox Code Playgroud)