Consider the following setup:
@Entity(name="Parent")
public static class Parent {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
public Long id;
@ElementCollection
public List<Child> children;
}
@Embeddable
public static class Child {
@Column(name="field")
public String field;
@Column(insertable = false)
public String nonInsertable;
@Column(updatable = false)
public String nonUpdatable;
@Column(name="field", insertable = false, updatable = false)
public String shadowField;
}
The updatable and insertable properties are ignored when generating statements. In the above example this results in the following:
Not only the nonInsertable and nonUpdatable fields are attempted to set but there is an extra 5th parameter for the shadowField which is mapped to the field with the same name. Note that the column duplicate check is passing because it does consider insertability and updatability of a field. I have a test case and a proposed fix which I'm going to push shortly. |