@ReturnInsert annotaion on primary key derived out of virtual column

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

@ReturnInsert annotaion on primary key derived out of virtual column

Ravi babu Tummuru
Hi Lukas,...
     I have a virtual column which is very important for our database
template
and every table who has that virtual column presents problems on
generated joins by Named Queries.

The virtual column is part of primary key. However, it's a non
insertable and
updatable field. I couldn't map the column inside @EmbeddedId on Java
entity.


Java entities example.

The virtual column name is DIA_DT_RECIBO.
Its value is defined by another column value named DT_RECIBO. Its default
value is TO_NUMBER(TO_CHAR("DT_RECIBO",'DD')).
The code is outside the PK -> TbReciboNfce.java and
TbReciboDetalheNfce.java.
=====

They resolved the issue by adding below code

 > On virtual column inside the PK:

ReturnInsert(returnOnly = true)
Column(name = "DIA_DT_RECIBO")
private long diaDtRecibo;

-> On join:

JoinColumn(name = "DIA_DT_RECIBO", referencedColumnName = "DIA_DT_RECIBO",
insertable = false, updatable = false)

Is this a OK solution to use...?  I don't see any issue there, but need
confirmation from u too.
Thanks
Ravi
_______________________________________________
eclipselink-dev mailing list
[hidden email]
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://www.eclipse.org/mailman/listinfo/eclipselink-dev