使用@Convert按属性筛选条件

时间:2017-11-27 07:21:48

标签: spring postgresql criteria hibernate-criteria

我有一个带有字符串列表的简单类,这个列表在db中使用@Convert转换为一列,现在我正在尝试根据类型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;
}

和标准:     c2.add(Restrictions.ilike("type", matchValue, MatchMode.ANYWHERE));

但我得到了这个例外:

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

*所有条目都有一个值,我使用的是psql db

1 个答案:

答案 0 :(得分:2)

现在无法使用Hibernate。

请参阅错误标签:https://hibernate.atlassian.net/browse/HHH-9991