EclipseLink and Nullable Parts composite key [message #1700871] |
Tue, 07 July 2015 18:48 |
|
I Have the Following Database Table
Some_Table
----------------
ID_A INT
ID_B INT
ID_C STRING
VALUE STRING
(ID_A,ID_B and ID_C) together for the composite key.
but it may be that ID_A or ID_B is null
i try to solve this as follows
@Entity
@Table(name="Some_Table")
public class SomeTable {
@Column(name="VALUE")
private String value;
@EmbeddedId
private MyKey id;
}
public class MyKey {
@Column(name="ID_C", insertable=false, updatable=false) //cause actually
private String idC;
@Column(name="ID_A", insertable=false, updatable=false)
private BigDecimal idA;
@Column(name="ID_B", insertable=false, updatable=false)
private BigDecimal idB;
}
but that is not working:
during the execution of the query was detected to be null. Primary keys must not contain null.
i even tried to add a @Convert(converter=KeyConverter.class) AttributeConverter
but that doesn work either since the converter is never called an so i cannot return a dummy BigDecimal if DB value is Null
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Day Job: https://www.everest-systems.com
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.05008 seconds