Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Manish Kumar Jaiswal
Findermethod in Liferay
September 27, 2012 2:53 AM
Answer

Manish Kumar Jaiswal

Rank: Regular Member

Posts: 133

Join Date: November 25, 2008

Recent Posts

Why do we need to copy and paste the generated finder method from EntityUtil.java to EntityLocalServiceImpl.java to access it from EntityLocalServiceUtil API , I mean why it is not Autogenerated in Liferay is it a BUG ? or it SB is developed that way if yes what was the reason ?

Regards
Manish
Alireza Zare
RE: Findermethod in Liferay
September 27, 2012 6:20 AM
Answer

Alireza Zare

Rank: Regular Member

Posts: 110

Join Date: September 3, 2010

Recent Posts

Standard finders will just be genereated. You just need to add your extra finders.
Pinkesh Gandhi
RE: Findermethod in Liferay
September 28, 2012 2:31 AM
Answer

Pinkesh Gandhi

Rank: Regular Member

Posts: 100

Join Date: January 26, 2012

Recent Posts

Whatever finder methods you specified in service.xml, all those will be auto generated so you don't need to copy paste those methods.
But if you want to add some extra methods which you have not specified in service.xml, in that case you need to write it into <EntityName>LocalServiceImpl.java.

I hope this will clear your doubts.
David H Nebinger
RE: Findermethod in Liferay
September 28, 2012 5:10 AM
Answer

David H Nebinger

Community Moderator

Rank: Liferay Legend

Posts: 11770

Join Date: September 1, 2006

Recent Posts

Pinkesh Gandhi:
Whatever finder methods you specified in service.xml, all those will be auto generated so you don't need to copy paste those methods.
But if you want to add some extra methods which you have not specified in service.xml, in that case you need to write it into <EntityName>LocalServiceImpl.java.


Just plain wrong.

The finders are generated in the persistence classes only. They are not exposed via the XxxServiceImpl or XxxLocalServiceImpl.

The fact is that SB doesn't really know that you've created a finder that you want to be in the XxxServiceImpl or the local one.

Heck, it might just be an internal finder that you're going to wrap code around in the service classes. I do that with my entities all the time - validate parms, check logical fkey relationships, etc. Some of my finder methods are never exposed, but I do let SB build them for me in the persistence layer...