orm - How to use @Formula (in Hibernate) to refer to the same (current) object -



orm - How to use @Formula (in Hibernate) to refer to the same (current) object -

i have class

@entity @table(name = "db.appl_session") @attributeoverrides({@attributeoverride(name = "id", column = @column(name = "appl_session_id"))}) @sequencegenerator(name = "tablesequence", sequencename = "db.appl_session_sq") public class aisession{ @formula("(select sum(nvl(budg.amt_ov,budg.amt)) db.budget budg budg.appl_session_id = appl_session_id)") private localdate realsessionstartdate;

in above formula working db.budget object , current object id ( appl_session_id). wanted work next fellow member variable (startdate) in aidapplicantyearsession class

@basic @temporal(temporaltype.date) @column(name = "start_ov_dt") private date overridestartdate;

how should write formula looks above on uses object's fellow member variable ? came with

@formula("(select start_ov_dt db.appl_session)")

is right way? logic 2 formulas totaly different.

@formula inserted sql select clause, can utilize column names in it:

@formula("start_ov_dt")

see also:

5.1.4.1.5. formula

hibernate orm formula

Comments

Popular posts from this blog

How do I check if an insert was successful with MySQLdb in Python? -

delphi - blogger via idHTTP : error 400 bad request -

postgresql - ERROR: operator is not unique: unknown + unknown -