3

Creating a List<> Member with Spring Roo that does not answer my question!

So what I want to do is "field list --fieldName addressList" but the Spring roo seems only allow "field set --fieldName addressList --type ~.model.A" and I can't even do " field set --fieldName addressList --type java.lang.String"

so it should be very simple but how come it doesn't support that? or what should I be doing instead to achieve the same result?

4

1 回答 1

0

“怎么不支持?”

因为框架的这一部分旨在表示持久实体的关系。为什么要与(未设置的)列表相关联?您如何知道该条目是否是相关记录的一部分,而不仅仅是重复记录?

“而且我什至不能做” field set --fieldName addressList --type java.lang.String“”

那是因为 java.lang.String 不是 jpa 类。您只能将 jpa 实体相互关联。

您应该使用与此对象相关的字符串字段表示来创建地址类。

entity jpa --class ~.Address
field string AddressLine1 --notNull
field string AddressLine2 
focus --class ~.YourClassThatNeedsAnAddressList
field set --fieldName addressList --type ~.Address

现在 ~.YourClassThatNeedsAnAddressList 的每个实例都可以有多个与之关联的地址。每个地址由两个字符串组成。

于 2013-02-20T20:25:58.623 回答