Как сохранить значение коллекции свойств сущности по умолчанию в базе данных с помощью HibernateJAVA

Программисты JAVA общаются здесь
Anonymous
Как сохранить значение коллекции свойств сущности по умолчанию в базе данных с помощью Hibernate

Сообщение Anonymous »


I have an entity, that has a collection field:

@Type(type = "jsonb") @ColumnDefault("'[\"V1\",\"V2\"]'") @Column(columnDefinition = "jsonb", nullable = false) private Collection myCollection = new ArrayList(); If "myCollection" field will be null and Hibernate will try to save it into DB, it will fall, because it will try to insert null value. How can I configure Hibernate, if this value is null in this entity, it should generate "DEFAULT" value in insert command? Why it doesn't see nullable = false in @Column?


Источник: https://stackoverflow.com/questions/781 ... ng-hiberna

Вернуться в «JAVA»