i'm trying delete multiple rows(if any) using jpa, , nullpointer exception. parameter , entity manager not null. ideas might causing exception?
p.s class annotated @transactional
@override public void removeaccount(string id) { try { int deleterecords = entitymanager.createquery("delete bankaccount b b.accountnumber = ?1", bankaccount.class) .setparameter(1, accountnumber) .executeupdate(); } catch (exception ex) { ex.getmessage(); } }
you don't have put second parameter, put class name in query. bankaccount
, string id
never used in method.
int deleterecords = entitymanager.createquery("delete bankaccount b b.accountnumber = ?1") .setparameter(1, accountnumber) .executeupdate();
Comments
Post a Comment