Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Siby Mathew
Invoke methods in *PersistenceImpl classes of DLFileEntry
April 18, 2012 8:25 AM
Answer

Siby Mathew

Rank: Expert

Posts: 259

Join Date: March 4, 2011

Recent Posts

Hi all,
My scenario is regarding DLFileEntryPersistenceImpl.findByG_F_N() which throws an exception if result is null.
But as this method will be invoked multiple times during a page load, I dont want the code to throw the exception. Instead I want to invoke DLFileEntryPersistenceImpl.fetchByG_F_N() which returns only NULL.

But this method is invoked only in DLFileEntryUtil.java which cannot be directly accessed.
How can we invoke the DLFileEntryPersistenceImpl.fetchByG_F_N() through a service.

Can anyone please clarify.

Thanks,
Siby
David H Nebinger
RE: Invoke methods in *PersistenceImpl classes of DLFileEntry
April 18, 2012 9:23 AM
Answer

David H Nebinger

Rank: Liferay Legend

Posts: 6455

Join Date: September 1, 2006

Recent Posts

You cannot access the persistence layer directly.

Instead you should use the dynamic query API to call the service to return the list. The DQ api will not throw an exception when no results are found.
Siby Mathew
RE: Invoke methods in *PersistenceImpl classes of DLFileEntry
April 19, 2012 8:47 AM
Answer

Siby Mathew

Rank: Expert

Posts: 259

Join Date: March 4, 2011

Recent Posts

Hi David,
Thanks for your reply. I had planned this for a performance optimization.
As Dynamic query does not have a cache, don't you think it might create more overhead ?

Also is there no way to invoke a method already present in the PersistenceImpl class
David H Nebinger
RE: Invoke methods in *PersistenceImpl classes of DLFileEntry
April 19, 2012 8:52 AM
Answer

David H Nebinger

Rank: Liferay Legend

Posts: 6455

Join Date: September 1, 2006

Recent Posts

You cannot access the persistence methods outside of the service implementation classes.