Muhammad Abdullah
11/24/2021, 7:03 AM@Table("organisations")
data class Organisation(
@Id val id: UUID?,
val name: String = "",
val information: String = "",
val urls: Any?,
val emails: Any?,
val phoneNumbers: Any?,
val addresses: Any?,
val settings: Any?,
val active: Boolean = true,
val createdAt: Instant = Instant.now(),
val updatedAt: Instant = Instant.now(),
)
{
“name”: “Business Name”,
“information”: “Business Info”,
“phoneNumbers”: {
“office”: “+6172345678”,
“imam”: “+6142349876”
},
“emails”: {
“info”: “info@bus.com”,
“commity”: “commity@bus.com”
},
“addresses”: {
“address”: “2345 SomeStreet Road, MyTOWN, 1234",
“postal address”: “PO Box 123"
},
“urls”: {},
“settings”: {
“timeFormat”: “dd/MM/yyyy”,
“currency”: “AUD”
}
}
Any pointers or help would be greatly appreciated.
ThanksTies
11/24/2021, 8:27 AMMuhammad Abdullah
11/24/2021, 9:26 AMjava.lang.String
from Object value (token JsonToken.START_OBJECT
); nested exception is com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot deserialize value of type java.lang.String
from Object value (token JsonToken.START_OBJECT
)
at [Source: (PushbackInputStream); line: 4, column: 21] (through reference chain: com.masjidlink.api.Organisation[“phoneNumbers”])]@PostMapping
fun createNewOrganisation(@RequestBody newOrganisation: Organisation): ResponseEntity<Organisation> =
ResponseEntity<Organisation>(service.saveOrganisation(newOrganisation), HttpStatus.OK)
Ties
11/24/2021, 9:35 AMMuhammad Abdullah
11/24/2021, 9:39 AMTies
11/24/2021, 9:41 AMMuhammad Abdullah
11/24/2021, 9:43 AMTies
11/24/2021, 9:45 AMMuhammad Abdullah
11/24/2021, 9:47 AMTies
11/24/2021, 9:47 AMMuhammad Abdullah
11/24/2021, 9:49 AMŁukasz Pięta
11/29/2021, 6:05 PMjsonb
type (which is generally speaking json
optimized for certain operations such as exctracting the value of object associated with some key) in your entity class.
@Entity
@TypeDef(name = "jsonb", typeClass = JsonBinaryType.class)
class Foo(
@Id val id: UUID,
@Type(type = "jsonb")
@Column(columnDefinition = "jsonb")
val bar: Bar
)
Muhammad Abdullah
02/05/2022, 10:06 AM