我在 Tapestry 上遇到 tynamo 模型模块 (org.tynamo:tapestry-model-web:0.3.1:jar),我遇到了一个我无法处理的问题。
我有两个实体客户和合同。显然,客户有很多合同:
合同
@Entity
@BeanModels({ @BeanModel(reorder = "id") })
public class Contract {
[...]
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@Column(name="contract_id")
public Long getId() {
return id;
}
/**
* @return the client
*/
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "client_id", nullable = true)
public Client getClient() {
return client;
}
客户
@Entity
@BeanModels({ @BeanModel(reorder = "id") })
public class Client{
[...]
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@Column(name = "client_id")
public Long getId() {
return id;
}
/**
* @return the contracts
*/
@OneToMany(cascade = { CascadeType.ALL })
public List<Contract> getContracts() {
return contracts;
}
如果我排除合同,则当我尝试创建新客户端时一切正常
@BeanModels({ @BeanModel(exclude = "contrats") })
但是,如果我尝试在不排除合同的情况下添加一个,则会出现以下异常:
ERROR] pages.Add Render queue error in SetupRender[tynamo/PropertyEditBlocks:palette_set]: Failure reading parameter 'selected' of component tynamo/PropertyEditBlocks:palette_set: org.apache.tapestry5.ioc.internal.util.TapestryException
org.apache.tapestry5.ioc.internal.util.TapestryException: Failure reading parameter 'selected' of component tynamo/PropertyEditBlocks:palette_set: org.apache.tapestry5.ioc.internal.util.TapestryException [at classpath:org/tynamo/pages/PropertyEditBlocks.tml, line 39]
at org.apache.tapestry5.internal.structure.ComponentPageElementImpl$AbstractPhase.invoke(ComponentPageElementImpl.java:153)
at org.apache.tapestry5.internal.structure.ComponentPageElementImpl$SetupRenderPhase.render(ComponentPageElementImpl.java:181)
at org.apache.tapestry5.internal.services.RenderQueueImpl.run(RenderQueueImpl.java:72)
at org.apache.tapestry5.internal.services.PageRenderQueueImpl.render(PageRenderQueueImpl.java:124)
at $PageRenderQueue_419b37801cb0d.render(Unknown Source)
at $PageRenderQueue_419b37801cb0c.render(Unknown Source)
根据我对 Palette 组件的理解,这意味着应该存在的默认选定值......不是!什么是确切的,因为没有默认值!
如果我直接在数据库(MySQL)中添加一个客户端并且不从我的实体中排除这个字段,我可以毫无问题地显示和编辑它,但在添加新的时候仍然会出现问题。
我错过了什么?