Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
William Gosse
ExpandoValueLocalServiceUtil.getValue behavior
January 5, 2011 12:51 PM
Answer

William Gosse

Rank: Expert

Posts: 251

Join Date: July 4, 2010

Recent Posts

I'm seeing strange behavior with ExpandoValueLocalServiceUtil.getValue.

value = ExpandoValueLocalServiceUtil.getValue(companyId, className,
expTableName,
DOWNLOADLIMITCOLUMNNAME, classPK);
if (value != null){
downloadLimit = value.getString();
}

With the code above I ocassionally get back the wrong ExpandoValue which does not match the custom field type, DOWNLOADLIMITCOLUMNNAME, or classPK that I requested.

This wrong ExpandoValue will cause com.liferay.portlet.expando.ValueDataException to occur becuase it a Date, but the custom field that was requested is a String.

I'd like to know if anyone else has seen this behavior and if there is some kind of fix or work around.
Jelmer Kuperus
RE: ExpandoValueLocalServiceUtil.getValue behavior
January 5, 2011 1:08 PM
Answer

Jelmer Kuperus

Rank: Liferay Legend

Posts: 1192

Join Date: March 10, 2010

Recent Posts

It's a known (and extremely scary) issue

http://issues.liferay.com/browse/LPS-13048

What I did is add the following snippet to my ext-plugin/docroot/WEB-INF/ext-impl/src/META-INF/ext-spring.xml


 1<bean id="com.liferay.portal.kernel.cache.key.CacheKeyGeneratorUtil" class="com.liferay.portal.kernel.cache.key.CacheKeyGeneratorUtil">
 2    <property name="cacheKeyGenerators">
 3        <map>
 4            <entry key="com.liferay.portal.kernel.dao.orm.EntityCache">
 5                <bean class="com.liferay.portal.cache.key.JavaMD5CacheKeyGenerator" />
 6            </entry>
 7            <entry key="com.liferay.portal.kernel.dao.orm.FinderCache">
 8                <bean class="com.liferay.portal.cache.key.JavaMD5CacheKeyGenerator" />
 9            </entry>
10            <entry key="com.liferay.portal.language.LanguageResources">
11                <bean class="com.liferay.portal.cache.key.JavaMD5CacheKeyGenerator" />
12            </entry>
13            <entry key="com.liferay.portal.servlet.ComboServlet">
14                <bean class="com.liferay.portal.cache.key.JavaMD5CacheKeyGenerator" />
15            </entry>
16        </map>
17    </property>
18    <property name="defaultCacheKeyGenerator">
19        <bean class="com.liferay.portal.cache.key.JavaMD5CacheKeyGenerator" />
20    </property>
21</bean>
William Gosse
RE: ExpandoValueLocalServiceUtil.getValue behavior
January 5, 2011 3:12 PM
Answer

William Gosse

Rank: Expert

Posts: 251

Join Date: July 4, 2010

Recent Posts

Can you attach the file your ext-plugin/docroot/WEB-INF/ext-impl/src/META-INF/ext-spring.xml

to this post Thanks
Jelmer Kuperus
RE: ExpandoValueLocalServiceUtil.getValue behavior
January 6, 2011 1:34 AM
Answer

Jelmer Kuperus

Rank: Liferay Legend

Posts: 1192

Join Date: March 10, 2010

Recent Posts

The one i use on my project has a lot more stuff in it. But This would be a basic version
Attachments: ext-spring.xml (1.3k)
William Gosse
RE: ExpandoValueLocalServiceUtil.getValue behavior
January 6, 2011 9:32 AM
Answer

William Gosse

Rank: Expert

Posts: 251

Join Date: July 4, 2010

Recent Posts

I've done Liferay extensions for some of the events and auth classes but I'm not sure how this file would be deployed as an extension. Can you shed some light on that procedure?

I used the new Liferay IDE plugin for Eclipse to create and deploy my extension project.

Thanks again