Coding Global Background
Coding Global

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

Archiviert 2 years ago
2 Nachrichten
2 Mitglieder
2 years ago
In Discord öffnen
D
direct_x_34
Copy Paster!

I have a problem to get `["role1","role2","role3"]` from roles column. Here is the entity shown below ```@Entity 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?

Antworten (2)