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
So far so good.
now i want to refactor my entity's id to be a data class. for example:
before:
@Table("messages")
data classMessageEntity(
@Id
@Column("id")
valid:Int = 0,
}
after:
data classMessageId(privatevalvalue:Int) {
funtoInt() = value
overridefuntoString(): String= value.toString()
}
@Table("messages")
data classMessageEntity(
@Id
@Column("id")
valid:MessageId = MessageId(0)
}
Now whenever i save something with above save() function it does not return the write result like before (i.e. the id which is on purpose 0 does not get returned with the actual value). But the entity is saved properly in db with proper (auto-increased) id, meaning if i search for it the result is correct.
Additional info
Note: i have custom @WritingConverter & @ReadingConverter for this entity:
Note 2:
I searched through other issues and i found spring-projects/spring-data-r2dbc#49 and #218. I think my case is different from them since my entity is actual saved in db properly and with proper id.
The text was updated successfully, but these errors were encountered:
Thank you for the answer. I'm not familiar with composite identifiers, is there any issue/link/doc for this (i searched the issues and could not find one)?
You can follow #1276 for the composite primary key feature. Wrapping the primary key value in a different type creates a composite key type because the identifier type no longer matches a supported primitive type.
Hi, i have encountered a problem. I have a simple entity and im saving this entity in db with r2dbc using R2dbcEntityTemplate directly :
So far so good.
now i want to refactor my entity's id to be a data class. for example:
before:
after:
Now whenever i save something with above save() function it does not return the write result like before (i.e. the id which is on purpose 0 does not get returned with the actual value). But the entity is saved properly in db with proper (auto-increased) id, meaning if i search for it the result is correct.
Additional info
Note: i have custom @WritingConverter & @ReadingConverter for this entity:
Note 2:
I searched through other issues and i found spring-projects/spring-data-r2dbc#49 and #218. I think my case is different from them since my entity is actual saved in db properly and with proper id.
The text was updated successfully, but these errors were encountered: