servicebuilder创建clob字段

service.xml

 

<entity name="Foo" local-service="true" remote-service="true" table="FOO" cache-enabled="false">

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

例如我们让field1为clob类型。我们需要修改META-INF/portlet-model-hints.xml

内容如下

 

<?xml version="1.0"?>

<model-hints>
	<model name="com.longshine.model.Foo">
		<field name="fooId" type="long" />
		<field name="groupId" type="long" />
		<field name="companyId" type="long" />
		<field name="userId" type="long" />
		<field name="userName" type="String" />
		<field name="createDate" type="Date" />
		<field name="modifiedDate" type="Date" />
		<field name="field1" type="String">
			<hint-collection name="CLOBTYPE" />
		</field>
		<field name="field2" type="boolean" />
		<field name="field3" type="int" />
		<field name="field4" type="Date" />
		<field name="field5" type="String" />
	</model>
	<hint-collection name="CLOBTYPE">
		<hint name="max-length">2000000</hint>
	</hint-collection>
</model-hints>

build之后 就会在数据库中生成clob字段类型的field1字段。