I was trying to use @Formula in one of my entity classes. What I need to do is select a boolean from another entity.
I tried to put the property definition but it keeps throwing a NullPointerException when publishing, I did it as follows
@JoinColumn(name = "SOIR08_FECHA_CARGA", referencedColumnName = "SOIR15_CODI_FECHA", nullable = true)
@ManyToOne(fetch = FetchType.EAGER)
private FechaCarga loadDate;
@JoinColumn(name = "SOIR08_RECEPTOR", referencedColumnName = "SOIR05_CON_DISTRITO_TELEFONICO", nullable = true)
@ManyToOne(optional = true, fetch = FetchType.EAGER)
private DistrictPhone receiver;
@Formula("(select io.done from Table io where io.district = receiver and io.loadDate = loadDate)")
private Boolean isDone;
Then I tried putting the @Formula annotation in the getter
@Formula("(select io.done from Table io where io.district = receiver and io.loadDate = loadDate))")
public Boolean getIsDone() {
return isDone;
}
but when I access the page where the property must be shown I get ORA-00904: "APROB0_"."ISDONE": invalid identifier
Any idea,suggestion or workaround will be highly appreciated.
I couldn't find a way to use this annotation without getting errors. What I decided to do was to add a column in the table, and fill it when a insert was made, not the best way but I needed to do it fast and there was nothing on forums that worked for me. Thanks.