我想将外国策略生成器用于我班级中的一个关键属性。最简单的方法如: http ://blog.eyallupu.com/2011/01/hibernatejpa-identity-generators.html 或 http://www.coderanch.com/t/219256/ORM/databases/HBM-Annotation -Foreign-Generator 或 http://www.mkyong.com/hibernate/hibernate-one-to-one-relationship-example-annotation/
import java.util.Date;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.*;
import org.hibernate.annotations.GenericGenerator;
...
...
...
@GenericGenerator(
name = "myForeignGenerator",
strategy = "foreign",
parameters = @Parameter(name = "property", value = "osoba"))
@Id
@GeneratedValue(generator = "myForeignGenerator")
@Column(name = "IdPracownik", unique = true, nullable = false)
public int getIdPracownik() {
return this.idPracownik;
}
并且 Eclipse 显示错误:
“类型不匹配:无法从参数转换为注释”,下划线“@Parameter”注释。
这是为什么?