我的实体角色中的代码
@Embedded
@LazyCollection(LazyCollectionOption.FALSE)
@CollectionOfElements
@JoinTable(name = "TEST_TABLE", joinColumns = @JoinColumn(name = "ROLE_ID"))
@AttributeOverrides({
@AttributeOverride(name = "code", column = @Column(name = "TSTCODE")),
@AttributeOverride(name = "work", column = @Column(name = "TSTWRK"))
})
private List<TestID> tests;
}
测试ID类
@Embeddable
@AccessType("field")
public class TestID implements Serializable
{
private String code;
private String work;
// getters, setters
}
获取异常SQLGrammarException
Caused by: java.sql.SQLException: ORA-00904: "TESTS0_"."WORK": invalid identifier
实体管理器创建查询,尝试访问列 CODE 和 WORK 而不是@Column注释中的 TSTCODE 和 TSTWRk。
有任何想法吗?
休眠注释 3.2.1.ga
持久性 API 1.0
jboss-4.2.3.GA
更新:
如果将 TestID 类中的字段重命名为表的列名,则所有操作都正常
@Embeddable
@AccessType("field")
public class TestID implements Serializable
{
private String tstcode;
private String tstwks;