Laliwala IT Services

Laliwala IT Services
Website Development

Saturday, July 7, 2012

Jira - Liferay Table Column


Q:
I have a requirement for changing one of the liferay table's column from varchar(75) to longtext.

I tried this using ext-model-hints.xml, after required changes if i try to re-build the service it is overriding the changes i made in ext-model-hints.xml

By default in liferay, portal-model-hints.xml it is some thing like this
    <model name="com.liferay.portlet.journal.model.JournalFeed">
        <field name="type" type="String" />
    </model>


I changed it as below in ext-model-hints.xml
    <model name="com.liferay.portlet.journal.model.JournalFeed">
        <field name="type" type="String">
            <hint-collection name="TEXTAREA" />
        </field>
    </model>


I have seen some relevant issue in JIRA @ LEP-7406

Please guide me how can i achieve the required functionality

Thanks in advance

---------------------------
have you created a custom model-hints.xml file outlined in my previous post? you need to make your changes there and not in ext-model-hints.xml directly.

OR

as Minhchau pointed out in a separate thread, if you make the changes in the "classes" folder instead of the "src" folder, your changes should persist
Hi,

Thank you very much for the prompt reply.

If we go with classes way of approach every time we do ant clean operation at ext/ext-impl level we have to do build & rebuild (ant compile build-services) services. Every time we need to change the *.model-hints.xml file manually? I think without this change it may not be possible to do.
so have you tried adding your own model-hints.xml file in the src and place the name of your file into the portal-ext.properties outlined in my first post? Or did that not work?
Even in this case also if we do ant clean it will be same right?
not if your file is in "src" and also your portal-ext.properties ... you only lose generated files when doing a clean ... and ext-model-hints.xml is generated.
Hi!
So, I edited my ext-model-hists.xml and added <hint name="show-time"> false</hint>  there.

But, problem is - every time, I run ServiceBuilder for all services in project (we have it in our build file to refresh DB & SQL scripts) - that hints file regenereated - and my changes lost.

Are there any way to set hints in service.xml (for example), so every time I generate service with ServiceBuilder - they will go into model-hints file?

Thank you for any advice!



Hi,

we had the same problem.

After a lot of debugging I found out the problem is that it doesn't read the "modified" ext-model-hints.xml file in the Ext environment.

The proposed solution to add a new file to the model.hints.configs isn't suitable for me, mainly for two reason:

1. it doesn't work for automatically creating database scripts (if you don't want allow schema creation at runtime)
2. you had to keep updated the new file if you modify a service.xml which you have added some hint.


The solution is to simply add this to the app.server.ext.properties (I think it could also work with build.ext.properties):
classpath.ext=${project.dir}/ext-impl/src;${project.dir}/ext-service/src


then modify your hints directly in your ext environment at ext-impl/src/META-INF/ext-model-hints.xml and re-launch the service builder.
The hints will be kept and you can later execute the sql build-db target to create database scripts according to your hints.

I'm a little disappointed of the lack of reply from Liferay here.

No comments:

Post a Comment