Fórumok
How use custom Overrided Portal Service by hook in another custom portlet
omid ahmadi, módosítva 9 év-val korábban
How use custom Overrided Portal Service by hook in another custom portlet
Junior Member Bejegyzések: 37 Csatlakozás dátuma: 2013.08.27. Legújabb bejegyzések
Hi friends,
i'm using liferay 6.1 CE GA2 .
While i want to use JournalStructureFinderUtil method in my portlet i faced this error:
To solve this poroblem i decided to override JournalStructureLocalService by hook and add a new method to call this method :
My custom class code is here:
And finally , now my problem is How use custom Overrided Portal Service method by hook in another custom portlet???
tanks for your helpe
i'm using liferay 6.1 CE GA2 .
While i want to use JournalStructureFinderUtil method in my portlet i faced this error:
org.hibernateException: No Hibernate Session bound to thread , and configuration dose not allowed creation of no-transactional one
To solve this poroblem i decided to override JournalStructureLocalService by hook and add a new method to call this method :
JournalStructureFinderUtil.findByKeywords(companyId,
groupIds,
keywords,
0, end, obc);
My custom class code is here:
package com.liferay.journalStructure.finderUtil;
import java.util.List;
import com.liferay.portal.kernel.exception.PortalException;
import com.liferay.portal.kernel.exception.SystemException;
/*import com.liferay.portal.model.User;
import com.liferay.portlet.;
import com.liferay.portal.service.UserLocalServiceWrapper;*/
import com.liferay.portal.kernel.util.OrderByComparator;
import com.liferay.portlet.journal.model.JournalStructure;
import com.liferay.portlet.journal.service.JournalArticleImageLocalService;
import com.liferay.portlet.journal.service.JournalStructureLocalService;
import com.liferay.portlet.journal.service.JournalStructureLocalServiceWrapper;
import com.liferay.portlet.journal.service.persistence.JournalStructureFinderUtil;
public class MyJournalStructureFinderUtil extends JournalStructureLocalServiceWrapper
{
public MyJournalStructureFinderUtil(
JournalStructureLocalService journalStructureLocalService) {
super(journalStructureLocalService);
// TODO Auto-generated constructor stub
}
public List<journalstructure> findMyjournalStructuresByKeyword(
long companyId,
String keywords,
long[] groupIds,
int start,
int end ,
OrderByComparator obc) throws SystemException
{
//long companyId=10154;
return JournalStructureFinderUtil.findByKeywords(companyId,
groupIds,
keywords,
0, end, obc);
}
}</journalstructure>
And finally , now my problem is How use custom Overrided Portal Service method by hook in another custom portlet???
tanks for your helpe
Tanweer Ahmed ., módosítva 1 év-val korábban
RE: How use custom Overrided Portal Service by hook in another custom por
Expert Bejegyzések: 322 Csatlakozás dátuma: 2010.03.11. Legújabb bejegyzések
Hi Omid,
Sometime back I had come across the same issue. After fixing the issue, I wrote a blog on the fix at the link :
http://www.mpowerglobal.com/web/tanweer/blog/-/blogs/binding-hibernate-session-to-thread-in-liferay.
You can check if the solution works for you.
Regards,
Tanweer.
Sometime back I had come across the same issue. After fixing the issue, I wrote a blog on the fix at the link :
http://www.mpowerglobal.com/web/tanweer/blog/-/blogs/binding-hibernate-session-to-thread-in-liferay.
You can check if the solution works for you.
Regards,
Tanweer.
Andew Jardine, módosítva 9 év-val korábban
RE: How use custom Overrided Portal Service by hook in another custom por
Liferay Legend Bejegyzések: 2416 Csatlakozás dátuma: 2010.12.22. Legújabb bejegyzések
Hi Omid,
I imagine that you could solve this the same way you would to share service builder (service) libraries among multiple plugins. Move the inheritted class to a separate jar and place it in the global libraries (e.g. TOMCAT_HOME/lib/ext) so that it is accessible by all plugins. You can still use your hook, it just means that it will reference classes from the global classloader scope rather than it's own classloader.
I imagine that you could solve this the same way you would to share service builder (service) libraries among multiple plugins. Move the inheritted class to a separate jar and place it in the global libraries (e.g. TOMCAT_HOME/lib/ext) so that it is accessible by all plugins. You can still use your hook, it just means that it will reference classes from the global classloader scope rather than it's own classloader.