[Liferay 学习笔记]PRUser 中的prUser.setGender("");方法找不到的原因

在跟着Liferay in Action学习的时候,仿照示例代码进行模拟实现时遇到一个问题:从service.xlm运行Build Service后生成的PRUser中找不到该项,到底是怎么回事呢?读示例源代码时在Interface  PRUser中看到了该项的定义,但是根据规范 PRUser中是不建议开发者直接编辑该接口的。

最后查找资料找到原因了:

1、Gender属性是不持久化的实体属性,所以在service.xml中没有定义。

2、这种不持久化的实体属性需要在-Impl类中添加代码,然后运行Build Service后工具会自动抽取并更新接口中的定义。

 

我获得帮助的地址:

http://www.manning-sandbox.com/thread.jspa?threadID=42504

Hi,
The setGender() method does indeed exist. It's in PRUserImpl.java. Remember, the -Impl classes are the only places that you can add your own code. Anything you add there, the next time Service Builder is run, it propagates those methods to the interface and the rest of the class hierarchy. So the gender field becomes a non-persistent field in your model layer.
Hope this helps!
--Rich

转载于:https://www.cnblogs.com/MichaelLu/archive/2012/10/12/2720745.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值