首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 软件管理 > 软件架构设计 >

ofbiz学习札记(一)

2012-08-24 
ofbiz学习笔记(一)参照ofbiz开发指南第二章,开发环境ofbiz9.04+Derby+eclipse-heilo-3.6.1:一、修改数据库

ofbiz学习笔记(一)

参照ofbiz开发指南第二章,开发环境ofbiz9.04+Derby+eclipse-heilo-3.6.1:

一、修改数据库模型,在服务器重启时,同时更新实体层和数据库。

An "Entity Definition" is an XML element <entity> that defines the structure
of a data entity (think data structure) as well as its relationships (if any) to other
data entities.

例:${OFBizInstallFolder}\applications\party\entitydef, edit the
file entitymodel.xml

1、对实体“PostalAddress”进行修改

? <entity entity-name="PostalAddress" package-name="org.ofbiz.party.contact" title="Postal Address Entity">,

? 添加 <field? name="planet" type="name"></field>。

2、同时在实体引擎中 ${OFBizInstallFolder}\framework\entity\config file entityengine.xml.对应的

check-on-start="true"
add-missing-on-start="true"
重新run ofbiz,那么启动后,可以在console中看到

DatabaseUtil.java:318:WARN ] Entity [PostalAddress] has 19 fields but
table [OFBIZ.POSTAL_ADDRESS] has 18 columns.
DatabaseUtil.java:330:WARN ] Field [planet] of entity [PostalAddress]
is missing its corresponding column [PLANET]
DatabaseUtil.java:1711:INFO ] [addColumn] sql=ALTER TABLE OFBIZ.
POSTAL_ADDRESS ADD PLANET VARCHAR(100)
DatabaseUtil.java:343:INFO ] Added column [PLANET] to table [OFBIZ.
POSTAL_ADDRESS]

二、编辑用户界面 Editing the User-Interface

${OFBizInstallFolder}\applications\party\webapp\partymgr
\party, edit editcontactmech.ftl(ftl是freemarker)

?

在<#elseif "TELECOM_NUMBER" = mechMap.contactMechTypeId?if_exists>前加上如下代码。

? <tr>
?? <td size="30" maxlength="100" name="planet"
?????????????? value="${(mechMap.postalAddress.planet)!}">
??? </td>
?? </tr>

就可以在partymgr应用下面更新postal地址页面看到增加了一行 planet属性。

三、修改更新页面的save事件:

?

?

?

?

热点排行