Java 无法定位静态元模型字段
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/22863426/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Unable to locate static metamodel field
提问by xenoterracide
What does this error mean?
这个错误是什么意思?
07:48:42,807 ERROR [org.hibernate.jpa.internal.metamodel.MetadataContext] (ServerService Thread Pool -- 25) HHH015011: Unable to locate static metamodel field : com.lm.model.UserId_#id
This is how that field is defined
这就是该字段的定义方式
@Embeddable
public class UserId implements Identifier<UserId> {
@Column( name = "user_id", columnDefinition = "uuid" )
protected UUID id;
采纳答案by Augustin Ghauratto
It seems to be bug in Hibernate itself. It is described here: https://hibernate.atlassian.net/browse/HHH-8712
这似乎是 Hibernate 本身的错误。在这里描述:https: //hibernate.atlassian.net/browse/HHH-8712
回答by Sanjeev
I stumbled across the same issue. I don't think it is a bug. This error occurs when you add/edit your entity model, for example a new field was added in the entity class.
我偶然发现了同样的问题。我不认为这是一个错误。添加/编辑实体模型时会发生此错误,例如在实体类中添加了新字段。
To over come this error, you have to regenerate the meta model. Clean your project and build it gain.
为了克服这个错误,你必须重新生成元模型。清理您的项目并构建它。
If using Maven run maven clean. (provided you POM is configured correctly so that it regenerate the meta model which the JPA needs).
如果使用 Maven 运行 maven clean。(假设您正确配置了 POM,以便它重新生成 JPA 需要的元模型)。
回答by Systemsplanet
Try adding getter/setters to the fields on your abstract class. That fixed the issue for me.
尝试将 getter/setter 添加到抽象类的字段中。那为我解决了这个问题。