我有 1 个实体调用 Item 我希望能够将父项链接到子项。使用连接表来创建父/子关系。我无法获得任何好的文档。因此,如果有人有任何想法,我会全神贯注。
这就是我所拥有的......大部分时间都有效。
public class Item implements java.io.Serializable {
@Id
private Long id;
@ManyToOne(optional = true, fetch = FetchType.LAZY)
@JoinTable(name = "ITEMTOITEM", joinColumns = { @JoinColumn(name = "ITEMID") }, inverseJoinColumns = { @JoinColumn(name = "PARENTITEMID") } )
private Item parent;
@OneToMany(mappedBy = "parent", fetch = FetchType.LAZY)
private List<Item> children;
}
有时,当我想带回与此项目表相关的对象时,我会收到以下错误:
org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.springframework.webflow.engine.ActionExecutionException: Exception thrown executing [AnnotatedAction@6669ff5 targetAction = com.assisted.movein.web.common.nav.NavAction@6edf74b7, attributes = map['method' -> 'handleEntry']] in state 'oneTimeChargesAndFeesView' of flow 'in-flow' -- action execution attributes were 'map['method' -> 'handleEntry']'; nested exception is Exception [TOPLINK-4002] (Oracle TopLink Essentials - 2.0.1 (Build b04-fcs (04/11/2008))): oracle.toplink.essentials.exceptions.DatabaseException
Internal Exception: java.sql.SQLException: ORA-00904: "PARENTITEM_ITEMID": invalid identifier
Error Code: 904
Call: SELECT ITEMID, ITEMSHORTDESC, EFFENDDATE, ITEMDESC, PARENTITEM_ITEMID, ITEMTYPECODE FROM ITEM WHERE (ITEMID = ?)
bind => [1250]
Query: ReadObjectQuery(com.domain.Item)
任何帮助,将不胜感激。