【发布时间】:2016-07-20 20:26:24
【问题描述】:
如果我有import org.hibernate.annotations.*,IntelliJ 似乎不会对我大喊大叫,但如果我想使用来自org.hibernate.annotations.Type 和org.hibernate.annotations.Immutable 的@Type 或@Immutable 注释,IntelliJ 告诉我Cannot resolve symbol 'Immutable' ,Type 也是如此。
即使我明确导入我想要的类,我仍然会收到错误。
我是这样使用的:
import org.hibernate.annotations.Type; // Error: Cannot resolve symbol 'Type'
import org.hibernate.annotations.Immutable; // Error: Cannot resolve symbol 'Immutable'
import ...(other stuff)
@Entity
@Table(name = "T1")
@Immutable // Error: Cannot resolve symbol 'Immutable'
public class Info {
@Column(name = "A_DATE")
@Type(type="org.jadira.usertype.dateandtime.joda.PersistentDateTime") // Error: cannot resolve symbol 'Type'
private DateTime myDate;
...(other stuff)
}
此外,我的build.gradle 文件具有以下依赖项:
dependencies {
compile "org.hibernate:hibernate-core:4.2.3.Final"
compile "org.hibernate:hibernate-jpamodelgen:1.3.0.Final"
compile 'org.hibernate:hibernate-entitymanager:4.2.3.Final'
...(other stuff)
}
我已经使用 Gradle 清理并重建了项目。有什么想法吗?
【问题讨论】:
标签: java hibernate intellij-idea gradle annotations