Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
Axel M.
[solved]longtext, service.xml and servicebuilder.xml ?
February 15, 2008 8:54 AM
Answer

Axel M.

Rank: New Member

Posts: 21

Join Date: January 16, 2008

Recent Posts

Hello,

i want define longtext and not varchar(75)(String) in the service.xml for the servicebuilder. O.k. it seems it is not possible???

In your portlets, for Example Shopping - ShoppingItemField field description and values_, you make the same what i want, BUT this is not possible with the service.xml and servicebuilder .
Now, i can only define String and will get varchar(75).

How do you do it or what is the right way?

Axel
Ray Augé
Re: [Liferay Forums][3. Development]longtext, service.xml and servicebuilde
February 15, 2008 7:16 AM
Answer

Ray Augé

LIFERAY STAFF

Rank: Liferay Legend

Posts: 1206

Join Date: February 7, 2005

Recent Posts

> i want define longtext and not varchar(75)(String) in the service.xml
> for the servicebuilder. O.k. it seems it is not possible???
>


- Locate the file web-impl/classes/META-INF/ext-model-hints.xml

- Locate the specific entity and field..

- Add the model hints to make the field larger/smaller, etc...

- Re-run servicebuilder

e.g.

1        <field name="description" type="String">
2            <hint-collection name="TEXTAREA" />
3        </field>


look in portal-impl.jar!/META-INF/portal-model-hints.xml for many
examples..

And yes, this file influences the tables/columns generated. So make sure
to rebuild after adjustment.
Axel M.
RE: Re: [Liferay Forums][3. Development]longtext, service.xml and servicebu
February 15, 2008 8:53 AM
Answer

Axel M.

Rank: New Member

Posts: 21

Join Date: January 16, 2008

Recent Posts

Hello Ray,

haaa.. , thanks. This is exactly what i want.
O.k. i think i must study the creationprocess/servicebuilder a little bit more. emoticon

Thanks Axel
Glenn Powell
RE: Re: [Liferay Forums][3. Development]longtext, service.xml and servicebu
February 19, 2008 3:35 AM
Answer

Glenn Powell

Rank: Junior Member

Posts: 44

Join Date: January 8, 2008

Recent Posts

Hello,
This process seems to be a little messy. You have to edit a generated (modified) file in order to get your hints in the service. This is very annoying if you want to do a clean rebuild of all or some of the services. You cannot simply delete the ext-model-hints.xml file, but instead have to go thru and edit by hand, removing only the un-altered portions.
The hope may be that you will never have to do this, but the ideal is usually not the reality. If you remove or rename some fields in a service model which already have modified hints in the XML file, then you have to remove/rename those fields by hand.
This also means that this file must be checked into source control, which is never the desired paradigm for generated files.

There are several of these such "paradigm breaks" in Liferay. Another is the creation of tables in the generated SQL scripts to handle the "mapping-table" attribute of columns in service.xml.
I have already dealt with this one locally by changing ServiceBuilder (a very simple modification), but I'd hope to see that change implemented in future Liferay releases.

As for the hints, I will once again modify ServiceBuilder to generate these hints from the service.xml, but it will also require changes to the service.xml dtd which I'm not very enthusiastic about.

Are these improvements something that can be anticipated in future releases?
Ray Augé
RE: Re: [Liferay Forums][3. Development]longtext, service.xml and servicebu
February 19, 2008 6:13 AM
Answer

Ray Augé

LIFERAY STAFF

Rank: Liferay Legend

Posts: 1206

Join Date: February 7, 2005

Recent Posts

These hints are also used by the display logic which renders a field
using our display beans, like when we use

1<liferay-ui:input-field ... />


Hints need to be stored somewhere in a config file,
*-model-hints.xml is that file. So, we use this single file for
affecting both the generated SQL and the rendering logic.
Glenn Powell
RE: Re: [Liferay Forums][3. Development]longtext, service.xml and servicebu
February 20, 2008 12:17 AM
Answer

Glenn Powell

Rank: Junior Member

Posts: 44

Join Date: January 8, 2008

Recent Posts

Ray Augé:
Hints need to be stored somewhere in a config file,
*-model-hints.xml is that file. So, we use this single file for
affecting both the generated SQL and the rendering logic.


But isn't this file also generated by the ServiceBuilder process? Shouldn't the hints be defined with the rest of the service in the actual service.xml files?
Ray Augé
RE: Re: [Liferay Forums][3. Development]longtext, service.xml and servicebu
February 20, 2008 5:42 AM
Answer

Ray Augé

LIFERAY STAFF

Rank: Liferay Legend

Posts: 1206

Join Date: February 7, 2005

Recent Posts

> But isn't this file also generated by the ServiceBuilder
> process? Shouldn't the hints be defined with the rest of the service
> in the actual service.xml files?


Yes, but your changes persist.
Fuad Efendi
RE: Re: [Liferay Forums][3. Development]longtext, service.xml and servicebu
June 26, 2008 8:55 AM
Answer

Fuad Efendi

Rank: Regular Member

Posts: 148

Join Date: April 5, 2007

Recent Posts

I understand now why the same tag generates TEXTAREA or INPUT etc... Great, thanks!

<liferay-ui:input-field model="<%= JournalArticle.class %>" bean="<%= article %>" field="description" />
Jignesh Vachhani
RE: Re: [Liferay Forums][3. Development]longtext, service.xml and servicebu
January 15, 2009 11:01 PM
Answer

Jignesh Vachhani

Rank: Liferay Master

Posts: 755

Join Date: March 10, 2008

Recent Posts

I had one question. this change was reflecting when i added hints in /classes/META-INF/ext-model-hints.xml i.e. in classes folder. But when i did change in src, it got replaced with the original one. since we only make changes in src, how come for only this file we make change in classes. please clarify. thanks in advance.
Ray Augé
RE: Re: [Liferay Forums][3. Development]longtext, service.xml and servicebu
January 16, 2009 5:51 AM
Answer

Ray Augé

LIFERAY STAFF

Rank: Liferay Legend

Posts: 1206

Join Date: February 7, 2005

Recent Posts

whenever you modify the model-hints files, make sure to run the compile target before your service rebuild.

i.e. ant compile build-services
Johns Abraham
RE:Re: [Liferay Forums][3. Development]longtext, service.xml and servicebu
September 24, 2011 10:15 AM
Answer

Johns Abraham

Rank: New Member

Posts: 1

Join Date: October 1, 2010

Recent Posts

For me VARCHAR(length), STRING and TEXT types are possible with ext-model-hints.xml.
Is it possible to modify a database field with type LONGTEXT?
If yes, then how can I modify the ext-model-hints.xml for this change?
Thanks, Johns