Foros de discusión

CLOB fields in service builder

thumbnail
Aritz Galdos, modificado hace 13 años.

CLOB fields in service builder

Expert Mensajes: 416 Fecha de incorporación: 15/05/07 Mensajes recientes
Hi people:

I´ve been asked to create an entity with the service builder which contains a CLOB field (image) in it.

I guess it should be declared as String in the service builder. But whats next?

I shuold manage to convert it back and forth to and from byte array and so...
Is there any lib/class for this purpouse in LR?

By the way, it is 6.0.5 version. I heard that since 6 series, images are no longer stored in the data base by default. Right?

Thnaks!
thumbnail
Sandeep Nair, modificado hace 13 años.

RE: CLOB fields in service builder

Liferay Legend Mensajes: 1744 Fecha de incorporación: 6/11/08 Mensajes recientes
Hi,

You can do the following steps.

Entry in service.xml

<column name="clobData" type="String" />

Build service

Open portlet-model-hints.xml

Add hint collection for clob as under

<hint-collection name="CLOB">
<hint name="max-length">2000000</hint>
</hint-collection>

Edit hint definition for the column in above case my column name is clobData

<field name="clobData" type="String">
<hint-collection name="CLOB" />
</field>

Build service again and deploy

To convert byte array to String use the following

Base64.objectToString(bytes);

To convert String to byte use the following

(byte[])Base64.stringToObject(stringValue);

Regards,
Sandeep
thumbnail
Behzad Gadimi, modificado hace 11 años.

RE: CLOB fields in service builder

Junior Member Mensajes: 36 Fecha de incorporación: 8/03/11 Mensajes recientes
Sandeep Nair:
Hi,

You can do the following steps.

Entry in service.xml

<column name="clobData" type="String" />

Build service

Open portlet-model-hints.xml

Add hint collection for clob as under

<hint-collection name="CLOB">
<hint name="max-length">2000000</hint>
</hint-collection>

Edit hint definition for the column in above case my column name is clobData

<field name="clobData" type="String">
<hint-collection name="CLOB" />
</field>

Build service again and deploy

To convert byte array to String use the following

Base64.objectToString(bytes);

To convert String to byte use the following

(byte[])Base64.stringToObject(stringValue);

Regards,
Sandeep


what is the maximum image size that can be stored in CLOB filed?
what is max-length in this example?