You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello. The library is great and has been very useful, but I have an use case which we need to have a different configuration to serialize the json in the second column in the same table. Based on what I found about, the library uses Jackson object mapper to do the serialization and I found this article https://vladmihalcea.com/hibernate-types-customize-jackson-objectmapper/ which was a bit difficult to follow from my side, sorry. I am not sure if this is what would support this issue? Is there a way to a pass a different object mapper class with different configuration to be used in only of the jsonb columns?
@Entity
@Table(name = "my_table")
class MyTable(
@Id
var id: String,
@Type(JsonType::class)
@Column(columnDefinition = "jsonb")
var bookings: List<Booking>,
@CreationTimestamp
@Column(name = "created_at", updatable = false)
var createdAt: LocalDateTime? = null,
@UpdateTimestamp
var updatedAt: LocalDateTime? = null,
@Type(JsonType::class)
@Column(columnDefinition = "jsonb")
var details: List<Detail>,
)
I would happily contribute to include documentation of how to achieve this use case. Thank you.
The text was updated successfully, but these errors were encountered:
danielferreiradf
changed the title
Understand custom object mappers
Understanding custom object mappers to specific jsonb column
Oct 30, 2024
@danielferreiradf The JsonType has various constructors that can help you provide a custom ObjectMapper, like the JsonType(ObjectMapper objectMapper) one.
You could extend the JsonType to provide your custom ObjectMapper from a given static context and then declare the entity attribute to use the extended JsonType.
Hello. The library is great and has been very useful, but I have an use case which we need to have a different configuration to serialize the json in the second column in the same table. Based on what I found about, the library uses Jackson object mapper to do the serialization and I found this article https://vladmihalcea.com/hibernate-types-customize-jackson-objectmapper/ which was a bit difficult to follow from my side, sorry. I am not sure if this is what would support this issue? Is there a way to a pass a different object mapper class with different configuration to be used in only of the jsonb columns?
I would happily contribute to include documentation of how to achieve this use case. Thank you.
The text was updated successfully, but these errors were encountered: