aileftech / snap-admin

A plug-and-play, auto-generated CRUD database admin panel for Spring Boot apps
MIT License
262 stars 20 forks source link

Type `Map` is not supported #23

Open fabienfleureau opened 1 year ago

fabienfleureau commented 1 year ago

Describe the bug There is an error for entity that contains field of type Map.

Is the bug at startup before you perform any action? Not applicable

@Entity code

    @Type(value = io.hypersistence.utils.hibernate.type.json.JsonType::class)
    @Column(name = "cost_details", updatable = false, nullable = false, columnDefinition = "jsonb")
    val map: Map<AnyEnumTypeOrString, String>,
aileftech commented 1 year ago

This one is a bit more complicated than a standard field because we don't currently support the @Type annotation. I will look into this as well but it's going to take a bit more time :)

aileftech commented 11 months ago

I've looked into this because I ended up using json fields in one of my projects.

The current behaviour is that these columns are not shown when looking at the table. If you SELECT * from the SQL console though, they appear in their JSON representation as text.

Since the @Type annotation can be used not just with Map but with any object, I can't introduce a specific support for Map. So I'll look into supporting this as if they are just "text" fields with the JSON value.