简体   繁体   English

JPA实体没有表中的列,但基于实体中不存在的列进行查询

[英]JPA Entity not having the column from the table but query based on the non existing column in the entity

I have an entity called Person which represent person_tb person_tb has 10 fields that includes zip and country . 我有一个名为Person的实体,它表示person_tb person_tb有10个字段,其中包括zipcountry But these columns are not specified in the Person entity. 但是,这些列未在Person实体中指定。 The entity contains only 8 columns out of 10 columns in the actual table. 该实体在实际表中的10列中仅包含8列。

Can I still run the query against person entity referring to the non-existing fields (but existing in the actual table)? 我是否仍然可以针对引用不存在的字段(但在实际表中存在)的人员实体运行查询? (I am assuming its not possible) (我假设这是不可能的)

If the above is not possible, can I write native query based on the missing fields in the entity? 如果上述方法不可行,是否可以根据实体中缺少的字段编写本机查询?

是的-您可以为此使用本机SQL查询

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM