Filter Criteria by attribute with @Convert

Viewed 709

I have a simple class with a list of Strings and this list is converted to be one column in db with @Convert and now i'm trying to create a criteria based on type attrbute.

@Entity(name = "my_table")
public class MyTable implements Serializable {
  @Id
  @GeneratedValue(strategy = GenerationType.IDENTITY)
  private Long id;

  @Column
  @Convert(converter = StringListConverter.class)
  private List<String> type;
}

and criteria : c2.add(Restrictions.ilike("type", matchValue, MatchMode.ANYWHERE));

but I got this exception :

org.springframework.orm.jpa.JpaSystemException: Error attempting to apply AttributeConverter; nested exception is javax.persistence.PersistenceException: Error attempting to apply AttributeConverter

*all entries have a value and I use a psql db

1 Answers
Related