interface User:Persistable,Serializable {
@get:Key
@get:Generated
val id: Long?
var email: String?
var lastName: String?
var username: String?
var name: String?
var password: String?
var phone: String?
@get:Column( name="datereg")
var registrationDate:Long?
var address:String?
var birthday: Date?
@get:ManyToOne
@get:Column(name="idcity", foreignKey = [ ForeignKey(referencedColumn= "idcity"), ForeignKey(referencedColumn= "idcountry")])
var city:City?
@get:ManyToOne
@get:ForeignKey
@get:Column(name="idcountry")
var country:Country?
}
and this is my log
INFO: preUpdate wuser [9, null, null, null, test3@email.com, com.cps.common.entity.CityEntity, com.cps.common.entity.CountryEntity, test3, test3, test3432, 3221341234, test3]
Jun 20, 2019 5:44:40 PM io.requery.sql.LoggingListener preUpdate
INFO: preUpdate City [0, 107, null, null]
Jun 20, 2019 5:44:40 PM io.requery.sql.LoggingListener beforeExecuteUpdate
INFO: beforeExecuteUpdate insert into City (idcountry, idcity, name, position) values (0, 107, NULL, '') on conflict (idcountry, idcity) do update set idcountry = EXCLUDED.idcountry, idcity = EXCLUDED.idcity, name = EXCLUDED.name, position = EXCLUDED.position sql:
insert into City (idcountry, idcity, name, position) values (?, ?, ?, ?) on conflict (idcountry, idcity) do update set idcountry = EXCLUDED.idcountry, idcity = EXCLUDED.idcity, name = EXCLUDED.name, position = EXCLUDED.position
([0, 107, null, null])
I had to annotate some interfaces to avoid Jackson mapper error
I.E
i'm trying to update some null fields in a table, some of them are references to another tables:
@Entity @Table(name = "wuser") //@JsonIgnoreProperties(ignoreUnknown=true)
and this is my log
I had to annotate some interfaces to avoid Jackson mapper error I.E
this is json I converted back to entity(User entity)
what is the right way to update with inner referenced entities?