|
I've created a sample project that demonstrates the issue
https://github.com/johnament/hibernate-attr-converter
You can override the hibernate version to 4.3.11, 5.0.1 the issue is present in both.
If you run JPA1Test#shouldInsertNewSimpleEntityAndUpdateWhenSettingName the console output includes
Hibernate: drop table simple if exists Hibernate: create table simple (id bigint not null, name varchar(255), primary key (id)) Hibernate: select simpleenti0_.id as id1_0_0_, simpleenti0_.name as name2_0_0_ from simple simpleenti0_ where simpleenti0_.id=? Hibernate: insert into simple (name, id) values (?, ?) Hibernate: update simple set name=? where id=?
Which looks right, but it requires you to explicitly call setName on the entity. This is prevalent in #shouldInsertNewSimpleEntityButDoesntUpdateWHenModName, which is the preferred way to modify the entity.
Is there anyway to make this work, other than making hibernate aware of these entities as well?
|