Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Aritz Galdos
CLOB fields in service builder
October 22, 2010 3:15 AM
Answer

Aritz Galdos

Rank: Expert

Posts: 405

Join Date: May 15, 2007

Recent Posts

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!
Sandeep Nair
RE: CLOB fields in service builder
October 22, 2010 3:47 AM
Answer

Sandeep Nair

Rank: Liferay Legend

Posts: 1721

Join Date: November 5, 2008

Recent Posts

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
Behzad Gadimi
RE: CLOB fields in service builder
February 21, 2013 4:20 AM
Answer

Behzad Gadimi

Rank: Junior Member

Posts: 31

Join Date: March 8, 2011

Recent Posts

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?