java - Saving entity using crudrepository taking too much time -
java - Saving entity using crudrepository taking too much time -
i trying update entry in db using crudrepository taking ~ 24 seconds each iteration. below code. in advance.
for(tmp.request.number numb : num_list){ enterprisevnumblist addnumb = entnumbdao.findbyvnumbmsisdnandenterpriseid(numb.getnumber(), frmentp); if(addnumb != null){ addnumb.setenterpriseid(toentp); // toent class enterprise entnumbdao.save(addnumb); // entnumbdao enterprisevnumblistrepo addentptoent++; }else{ log.error("numbprocessing: failed to"); }
here enterprisevnumblist class
@entity @table(name = "enterprise_vnumb_list", uniqueconstraints = { @uniqueconstraint(columnnames = {"vnumb_msisdn"})}) @xmlrootelement public class enterprisevnumblist implements serializable { @size(max = 10) @column(name = "parent_id") private string parentid; private static final long serialversionuid = 1l; @id @generatedvalue(strategy = generationtype.identity) @basic(optional = false) @column(name = "id", nullable = false) private long id; @basic(optional = false) @notnull @size(min = 1, max = 30) @column(name = "vnumb_msisdn", nullable = false, length = 30) private string vnumbmsisdn; @size(max = 30) @column(name = "imsi", length = 30) private string imsi; @column(name = "assigned") private boolean assigned; @size(max = 30) @column(name = "assigned_to_sim", length = 30) private string assignedtosim; @joincolumn(name = "enterprise_id", referencedcolumnname = "enterprise_id", nullable = false) @manytoone(optional = false) private enterprise enterpriseid; /// code here }
// here enterprisevnumblistrepo class
@repositorydefinition(domainclass=enterprisevnumblist.class, idclass=integer.class) public interface enterprisevnumblistrepo extends crudrepository<enterprisevnumblist, integer>, jpaspecificationexecutor<enterprisevnumblist>{ enterprisevnumblist findbyvnumbmsisdnandenterpriseidandassigned(string vsim, enterprise enterpriseid, boolean assgn); enterprisevnumblist findbyvnumbmsisdnandenterpriseid(string vsim, enterprise enterpriseid); list<enterprisevnumblist> findbyenterpriseidandassigned(enterprise entp, boolean assgn); enterprisevnumblist findbyvnumbmsisdnandassignedtosim(string vsim, string sim); enterprisevnumblist findbyvnumbmsisdnandenterpriseidandassignednot(string vsim, enterprise enterpriseid, boolean assgn); long countbyenterpriseidandassigned(enterprise entp, boolean assgn); long countbyenterpriseid(enterprise entp); }
java spring
Comments
Post a Comment