Hibernate: Load entities with Formula

会有一股神秘感。 提交于 2019-12-01 10:55:40

问题


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:


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


来源:https://stackoverflow.com/questions/7098722/hibernate-load-entities-with-formula

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!