removing all entries from a table

Hello, I have created an Entity called “Portfolio”. I’d like to populate the table with a bunch of portfolios. For example, when a user clicks a button, my code will persist PortA and PortB.
Could you share some code to remove all entries? Ideally, I would like:

  • a method to delete all records in the Portfolio table
  • a method to upsert records in the Portfolio table (i.e. if the record doesn’t exist, insert it).
    Thanks.

Do you want to manipulate with entities right in the screen controller, or in a middleware service?
Both options are possible:

The Data Manipulation sample is updated.

  • Working with EntityManager and DataManager on the middle tier: see createOrUpdateCustomer(), deleteAll() methods of the CustomerServiceBean class
  • Working with DataManager on the client tier: see onCreateInController() method of the CustomerBrowse class.