这是个用Annotation做的项目,其中修改页面能取到数据,但提交时总是报这样的错:
2010-07-29 23:05:54,453 [http-8088-Processor21] ERROR [500.jsp] - No row with the given identifier exists: [org.gd.deplatform.entity.entity.TTable#ADAB018]
org.hibernate.ObjectNotFoundException: No row with the given identifier exists: [org.gd.deplatform.entity.entity.TTable#ADAB018]
at org.hibernate.impl.SessionFactoryImpl$2.handleEntityNotFound(SessionFactoryImpl.java:419)
at org.hibernate.proxy.AbstractLazyInitializer.checkTargetState(AbstractLazyInitializer.java:154)
at org.hibernate.proxy.AbstractLazyInitializer.initialize(AbstractLazyInitializer.java:147)
at org.hibernate.proxy.AbstractLazyInitializer.getImplementation(AbstractLazyInitializer.java:174)
at org.hibernate.engine.StatefulPersistenceContext.unproxyAndReassociate(StatefulPersistenceContext.java:594)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:89)
我找了很久都没有找到该问题的真正答案,我估计出问题的地方应该是这些,我把主要的帖出来,打扰大家哈,帮我看哈,不甚感激,实体类:
public TTableItems(String itemCode, TTable TTable,
TReferenceCode TReferenceCode, String name, Character constraints,
String times, String itemType, BigDecimal itemLength,

BigDecimal precision, String description, String memo)
{
this.itemCode = itemCode;
this.TTable = TTable;
this.TReferenceCode = TReferenceCode;
this.name = name;
this.constraints = constraints;
this.times = times;
this.itemType = itemType;
this.itemLength = itemLength;
this.precision = precision;
this.description = description;
this.memo = memo;
}

@Id
@GeneratedValue(generator = "itemCode")
@GenericGenerator(name = "itemCode", strategy = "uuid")
@Column(name = "ITEM_CODE", unique = true, nullable = false, length = 8)

public String getItemCode()
{
return this.itemCode;
}


public void setItemCode(String itemCode)
{
this.itemCode = itemCode;
}

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name ="F_TABLE_CODE")
@NotFound(action=NotFoundAction.IGNORE)

public TTable getTTable()
{
return this.TTable;
}


public void setTTable(TTable TTable)
{
this.TTable = TTable;
}
Action类的save方法:
@Override

public String save() throws Exception
{
indexItemsManager.saveTTableItems(tTableItems);
addActionMessage("添加指标项成功");
return RELOAD;
}
修改页面代码:
<tr>
<td>指标编码:</td>
<td><input type="text" name="itemCode" size="40" id="itemCode" value="${itemCode}" readonly="readonly"/></td>
</tr>
<tr>
<td>指标分类代码:</td>
<td><input type="text" id="tableCode" name="tableCode" size="40" value="${TTable.tableCode}"/></td>
</tr>
这些是我估计出错的地方,网上说的方法我都试过,不起作用,实在没法了,麻烦大家看一眼,万分感激,水平不够,真的是没法了~~~~