Liferay Service Builder表在每次部署时自动递增

Liferay Service Builder表在每次部署时自动递增,liferay,liferay-service-builder,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

在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>

当我更改portlet的代码时。在每次部署中,其主键增加100。 因此,无论如何,只能将其设置为自动递增1。而且在每次部署时它不能增加100

选项1

将其添加到主键列
id type=“increment”

i、 e

<column name="fooId" type="long" primary="true" id-type="increment" />

缺点:这将影响您的绩效

谢谢@Parth,如果双方都有缺点的话。那么哪一个更好呢?@VarunArya取决于你的情况,先生!!如果您没有群集环境,请选择选项1,否则我不想更改为1。。如果主键是101201301a,我看不出有什么问题:选择选项3:一个id就是一个id。不要假设除了标识之外的任何东西。继续,还有更重要的问题要解决谢谢@ParthGhiya,这真的很有帮助。:)
#
# 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