0

I'm setting up a table in Postgres, and want to map List to jdbc array type using custom @Converter class. But I

get org.hibernate.MappingException: No Dialect mapping for JDBC type: 984991021

//StoredJob class for creating table:
@Entity
@Table(name = "jobs")
public class StoredJob {
 ....
//The error is here
@Column
@Convert(converter = JobFileListConverter.class)
private List<UUID> jobFiles;

//Converter class:
@Converter
public class JobFileListConverter implements 
                        AttributeConverter<List<UUID>, UUID[]> {
@Override
public UUID[] convertToDatabaseColumn(List<UUID> uuidList) {
    return uuidList.toArray(UUID[]::new);
}

@Override
public List<UUID> convertToEntityAttribute(UUID[] uuidArray) {
    return Arrays.asList(uuidArray);
}
SurPrise 2
  • 53
  • 7
  • What is your database schema ? I've used many times mapping to lists and I never encountered issues or needed a converter. If you're removing your converter it does not work ? – A Le Dref Sep 03 '19 at 07:11
  • Have a look here https://stackoverflow.com/questions/287201/how-to-persist-a-property-of-type-liststring-in-jpa and here https://stackoverflow.com/questions/4495233/postgresql-uuid-supported-by-hibernate perhaps – dpr Sep 03 '19 at 07:12
  • A Le Dref, if i remove converter i get another exception: Could not determine type for: java.util.List, at table: jobs, for columns: [org.hibernate.mapping.Column(job_files) – SurPrise 2 Sep 03 '19 at 07:23

1 Answers1

1

Change this:

private List<UUID> jobFiles;

with this one:

private UUID[] jobFiles;

But, I strongly suggest you to remove '@Convert' annotation and add a getter method as below:

public UUID[] getJobFiles() {
    return jobFiles.stream().toArray(UUID[]::new);
}