#How to get array info from column in Spring Boot JPA (exception Dialect mapping for JDBC type Error)

1 messages · Page 1 of 1 (latest)

storm silo
#

I have a problem to get ["role1","role2","role3"] from roles column.

Here is the entity shown below

public class User {
    //...

    @Column(columnDefinition = "text[]")
    @Type(type = "com.baeldung.hibernate.arraymapping.CustomStringArrayType")
    private String[] roles;

    // getters and setters
}```

Here is the JPARepository shown below
```public interface UserRepository extends JpaRepository<User, Long> {

    @Query(value = "SELECT DISTINCT unnest(u.roles)::text FROM User u", nativeQuery = true)
    List<String> findDistinctRoles();
}```

I got nested exception Dialect mapping for JDBC type?

How can I fix it?
celest roseBOT
#

⌛ This post has been reserved for your question.

Hey @storm silo! Please use /close or the Close Post button above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.

TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.

sullen totem
celest roseBOT
#

💤 Post marked as dormant

This post has been inactive for over 300 minutes, thus, it has been archived.
If your question was not answered yet, feel free to re-open this post or create a new one.
In case your post is not getting any attention, you can try to use /help ping.
Warning: abusing this will result in moderative actions taken against you.

storm silo
celest roseBOT
#

💤 Post marked as dormant

This post has been inactive for over 300 minutes, thus, it has been archived.
If your question was not answered yet, feel free to re-open this post or create a new one.
In case your post is not getting any attention, you can try to use /help ping.
Warning: abusing this will result in moderative actions taken against you.

storm silo
#

@sullen totem Can you help me if you have any idea ?

sullen totem
#

Stack trace maybe or small reproducer?

sullen totem
storm silo
storm silo
#

@Query(value = "SELECT DISTINCT unnest(u.roles)::text FROM User u", nativeQuery = true)
List<String> findDistinctRoles();

This part throw error.

#

My problem is there.