I am trying to save the null value of an attribute of an enumerated object in Java in Oracle . using JPA TopLink. The code is executed without exception or warning, but the object is not stored in the database.
An entity is defined as follows:
@Entity
public class LetterDoc {
...
@Column(name = "delivery_type", columnDefinition = "VARCHAR2(20)", nullable = true)
@Enumerated(EnumType.STRING)
private DocDeliveryTypeEnum deliveryType;
...
}
The Enum class DocDeliveryTypeEnum has only the required values.
public enum DocDeliveryTypeEnum {
NORMAL,
RECOMMENDED,
ACKNOWLEDGEMENT
}
, deliveryType . , null. , .
null, , , VARCHAR2 (20) NULL.
:
LetterDoc let = new LetterDoc();
let.setDeliveryType(null);
try {
emptyDocDAO.persist(let);
emptyDocDAO.flush();
} catch (Exception e) {
log.error(e);
}
, . , NoResultException.
, , ? Enum?
, , . , , .
.