Добрый день!
Почему-то не срабатывает признак “unique” для атрибута сущности, - спокойно сохраняю записи с дублированным атрибутом “code”.
Вот описание сущности (сущность сгенерирована из внешней базы):
package ru.roe.infocenter.entity;
import com.haulmont.chile.core.annotations.NamePattern;
import com.haulmont.chile.core.annotations.NumberFormat;
import com.haulmont.cuba.core.entity.BaseIntIdentityIdEntity;
import com.haulmont.cuba.core.global.DesignSupport;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
@DesignSupport("{'imported':true}")
@NamePattern("%s|name")
@Table(name = "cl_source")
@Entity(name = "infocenter_ClSource")
public class ClSource extends BaseIntIdentityIdEntity {
private static final long serialVersionUID = 2287848023803483006L;
@NotNull(message = "{msg://infocenter_ClSource.code.validation.NotNull}")
@NumberFormat(pattern = "#0")
@Column(name = "code", nullable = false, unique = true)
protected Integer code;
@NotNull(message = "{msg://infocenter_ClSource.name.validation.NotNull}")
@Column(name = "name", nullable = false, length = 250)
protected String name;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Integer getCode() {
return code;
}
public void setCode(Integer code) {
this.code = code;
}
}
