关于此注释的 Java 编译器错误?
hibernate级联注释值“org.hibernate”与变量“org”冲突,它采用“org”作为变量名,而不是包名的一部分。我收到错误:
.java:[14,16] cannot find symbol
[ERROR] symbol : variable hibernate
[ERROR] location: class java.lang.Object
[ERROR] Foo.java:[14,50] an enum annotation value must be an enum constant
这似乎是一个通用的 Java 编译器错误。当您定义与第一个包元素相同的对象变量时,应该是可重现的。
import javax.persistence.CascadeType;
import javax.persistence.OneToMany;
import org.hibernate.annotations.Cascade;
public class Foo {
Object org;
@OneToMany
@Cascade(org.hibernate.annotations.CascadeType.DELETE_ORPHAN)
Object foo;
@OneToMany(cascade=CascadeType.ALL)
Object foo2;
}
The hibernate cascade annotation value "org.hibernate" is conflicting with the variable "org", it's taking "org" as variable name, not part of the package name. I am getting error:
.java:[14,16] cannot find symbol
[ERROR] symbol : variable hibernate
[ERROR] location: class java.lang.Object
[ERROR] Foo.java:[14,50] an enum annotation value must be an enum constant
It seems to be a generic Java compiler bug. Should be reproducible when you define an object variable which is the same as the first package element.
import javax.persistence.CascadeType;
import javax.persistence.OneToMany;
import org.hibernate.annotations.Cascade;
public class Foo {
Object org;
@OneToMany
@Cascade(org.hibernate.annotations.CascadeType.DELETE_ORPHAN)
Object foo;
@OneToMany(cascade=CascadeType.ALL)
Object foo2;
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是 Java 如何确定含义的定义的一个名字。
This is definition of how Java determines the meaning of a name.