Hibernate: Load entities with Formula

2020-03-30 05:35发布

Is it possible to load an entity using a Formula?

For example:

@formula("(select * from myEntity ent where ent.isLatest = TRUE )")
publicmyEntity getmyEntity()
{
    return this.associatedPatientJournalEntries;
}

if so, how does the mapping have to look.

Also, what are alternatives to using formulas to load certain entities?

1条回答
我只想做你的唯一
2楼-- · 2020-03-30 06:16

You can, but the formula looks:

select ent from myEntity ent where ent.isLatest

Another alternatives are,

mounting the entity in your method.

post loading method
查看更多
登录 后发表回答