Var*_*rya 2 liferay liferay-service-builder
在liferay中,我有一个实体如下:
<entity name="Foo" local-service="true" remote-service="true">
<!-- PK fields -->
<column name="fooId" type="long" primary="true" />
<!-- Group instance -->
<column name="groupId" type="long" />
<!-- Audit fields -->
<column name="companyId" type="long" />
<column name="userId" type="long" />
<column name="userName" type="String" />
<column name="createDate" type="Date" />
<column name="modifiedDate" type="Date" />
<!-- Other fields -->
<column name="field1" type="String" />
<column name="field2" type="boolean" />
<column name="field3" type="int" />
<column name="field4" type="Date" />
<column name="field5" type="String" />
<!-- Order -->
<order by="asc">
<order-column name="field1" />
</order>
<!-- Finder methods -->
<finder name="Field2" return-type="Collection">
<finder-column name="field2" />
</finder>
</entity>
Run Code Online (Sandbox Code Playgroud)
当我更改 portlet 的代码时。在每次部署时,它的主键都会增加 100。所以无论如何都可以将它的自动增量设置为 1。并且每次部署时不得增加 100。
选项1
将此添加到您的主键列中 id-type="increment"
IE
<column name="fooId" type="long" primary="true" id-type="increment" />
Run Code Online (Sandbox Code Playgroud)
缺点: 这将打破集群环境
选项#2
在 portal-ext.properties 中添加这个
#
# Set the number of increments between database updates to the Counter
# table. Set this value to a higher number for better performance.
#
counter.increment=1 //by default it is 100
Run Code Online (Sandbox Code Playgroud)
缺点:这会影响你的表现。
| 归档时间: |
|
| 查看次数: |
1210 次 |
| 最近记录: |