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);
}
3
  • 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 ? Commented Sep 3, 2019 at 7:11
  • Have a look here stackoverflow.com/questions/287201/… and here stackoverflow.com/questions/4495233/… perhaps Commented Sep 3, 2019 at 7: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) Commented Sep 3, 2019 at 7:23

1 Answer 1

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);
}  
Sign up to request clarification or add additional context in comments.

2 Comments

But what if i want to operate with jobFiles as a list?
You can handle it using different getter/setter

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.