hibernate - How To Delete Rows From Temp Table With EntityDelete In CFSCRIPT -


if have array of entities loaded temp relation using ormexecutequery(), how can use entitydelete() delete entities.

i have tried entitydelete( temparr ) not work. however, able iterate through array , add each entity additional info new final relation.

here cfscript code:

temparr = ormexecutequery( "from temp cartid=#form.cartid#" ); transaction {     for( i=1; lte arraylen(temparr); i=i+1 ) {         reg = entitynew( "register" );         reg.setfirstname( temparr[i].getfirstname() );         ........         entitysave( reg );         ormflush();     }     entitydelete( temparr );//<<== not deleting entities } 

error:

- object passed not valid entity. 

use entitydelete( temparr[i] ); @ end of for-loop.

temparr = ormexecutequery( "from temp cartid=#form.cartid#" ); transaction {     for( i=1; lte arraylen(temparr); i=i+1 ) {         reg = entitynew( "register" );         reg.setfirstname( temparr[i].getfirstname() );         ........         entitysave( reg );         ormflush();         entitydelete( temparr[i] );//<<== works!!     } } 

Comments

Popular posts from this blog

google api - Incomplete response from Gmail API threads.list -

Installing Android SQLite Asset Helper -

Qt Creator - Searching files with Locator including folder -