javaliferayliferay-6liferay-service-builder

Delete All Records using Liferay Service Builder


I can delete specific record using Liferay Service Builder but what to do when I want to delete All the Records from that table.

I am new to Liferay So any Help would be appreciated...!!!


Solution

  • As your entity name is Location, add following method in your LocationLocalServiceImpl.java and build service:

    public void deleteAllLocations(){
        try{
            LocationUtil.removeAll();
        }catch(Exception ex){
            // Log exception here.
        }
    }
    

    On successful build, deleteAllLocations will be copied to LocationLocalServiceUtil.java from where you can use it in your action class as:

    LocationLocalServiceUtil.deleteAllLocations();