class declares multiple JSON fields named primaryKey
See original GitHub issueError:
java.lang.IllegalArgumentException: class run.flake.entities.database.users.UsersTable declares multiple JSON fields named primaryKey
Router:
get {
val server = transaction {
ServerRow.new {
name = serverName
owner = user
members = SizedCollection(user)
}
}
call.respond(transaction { server.toMap() }) // Here is error
}
.toMap()
:
fun <ID : Comparable<ID>> Entity<ID>.toMap2(): Map<String, Any?> {
return this::class.declaredMemberProperties
.associate {
it.name to it.apply { isAccessible = true }.call(this)
}
}
ServerRow
class ServerRow(id: EntityID<UUID>) : UUIDEntity(id) {
companion object : UUIDEntityClass<ServerRow>(ServersTable)
var name by ServersTable.name
var description by ServersTable.description
var members by UserRow via MembersTable
var owner by UserRow referencedOn ServersTable.owner
val groups by GroupRow referrersOn GroupsTable.server
val roles by RoleRow referrersOn RolesTable.server
var createdAt by ServersTable.createdAt
}
UserRow
:
class UserRow(id: EntityID<UUID>) : UUIDEntity(id) {
companion object : UUIDEntityClass<UserRow>(UsersTable)
var lokin by UsersTable.lokin
var password by UsersTable.password
var username by UsersTable.username
var region by UsersTable.locale
var registeredAt by UsersTable.registeredAt
var accessLevel by UsersTable.accessLevel
var isBanned by UsersTable.isBanned
}
Issue Analytics
- State:
- Created a year ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
class A declares multiple JSON fields - Stack Overflow
1. You cannot have two fields with the same name. 2. You cannot have two fields with the same serialized name. 3. Types...
Read more >class declares multiple JSON fields - How to tell Gson ... - GitHub
Hello, We are using Google Ad Manager axis API in our project. While converting LineItem object, we are getting the below error. java.lang....
Read more >Mapping Multiple JSON Fields to One Java Field | Baeldung
First, we're going to use the @JsonProperty annotation, so that Jackson knows the name of the JSON field to map.
Read more >Why Exclusion Strategy by name does not prevent “class ...
I am using GSON and getting "class Person declares multiple JSON fields named serialVersionUID", as the superclass of Person also has this ...
Read more >com.google.gson.FieldAttributes.getDeclaringClass java code ...
Constructs a Field Attributes object from the f. hasModifier. Returns true if the field is defined with the modifier.This method is meant to...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I started using jackson instead of GSON, after that it started working normally
@xiaoliang-cn looks like you are trying to serialize UserTable with gson. Can you show the complete stacktrace to confirm it?