How to delete all data in enityt in java action ?

0
Hi all,   I would like to delete all data in entity person before insert new record . what is the syntax to delete all data on entity    this the code that I create object  IMendixObject messageObject = Core.instantiate(context,"Mymodule.Person"); Thanks Somboon
asked
3 answers
2

Some code samples might help you out. Try this:

Core.delete(context, messageObject);

and this I found in communitycommons, folder  Batches, deleteAll:

return XPath.create(this.getContext(), entityType).deleteAll();

or this example in Unittest – findAllTests:

/*
 * Remove all modules without tests
 */
XPath.create(context, TestSuite.class).not().hasReference(UnitTest.MemberNames.UnitTest_TestSuite, UnitTest.entityName).close().deleteAll();

 

answered
0

If you already have the community commons in your app it is already there. Look at the deleteAll action in the community commons: https://marketplace.mendix.com/link/component/170

Regards,

Ronald

 

answered
0

This job is perfectly doable in Mendix itself. Why do you want to use Java for this?

answered