Entity cannot be used here because it is a non persistable

0
Hi i am trying to fetch data from mysql and display it in mendix, i have a created a non-persistent entity to store the data temporarily and display it..but i am getting the error as “The Entity cannot be used here because it is a non persistable” when i changed the entity as persistent then i am getting repeated values on the screen, like every time i refresh i am getting new repeated values(Previously stored values and additionally new values). Appreciate your efforts in guiding me through this. My Domain Model: Page where i am using this entity to fetch data (i am using in data grid): If i use persistent entity then getting duplicate values:
asked
2 answers
0

Hi Mohd,

 

That’s because you’re trying to get a non-peristable entity from the database. A non-presistent Entity lives in Memory and is never stored in the DB, hence you’ll be getting this error.

 

To solve this, you either change your entity to a persistent entity and make sure it is committed to the database, or you associate the data with a parent object that you pass as context to your page and then fetch the rows of data over association through the datagrid. This last option does support non-persistent entities that are not stored in the database.

answered
0

We need to use Association to use non-Persistent entity in data grid.

  1. Create Association between non-Persistent entity and persistent entity
  2. Pass the persistent entity as context in data view and then pass the non-Persistent entity as association in data grid.
answered