I have a table called "Endoso", this table has the properties of "id", "numEndoso","endosos_por_dia". The "numEndoso" is the id of the envio(id of table EnvioRemesa), and the "endosos_por_dia" property is a calculated property as I put below.
select count(*)
from documento d
inner join remesa r
on r.id = d.remesa_id
inner join envio_remesa er
on r.id = er.remesa_id
where r.id=?
What I want and can't do, is that for example when I calculate endosos_por_dia if 8 documents turn out, create 8 different records in my database, increasing from 1 to 8.And how could I put my calculated property query on my entity Endoso and it will be reflected in the database? How can I do this in hibernate?