java - Spring Rest API Insert data -
i facing error while inserting data mysql.i working in multi tier layer in spring getting error in calling data implementation manager controller repositary file refrence is
public interface deliverytimerepository extends jparepository<deliverytimeentity, long> { deliverytimeentity save(deliverytimeentity deliverytimeentity); }
code in access manager
public deliverytimerequestdo create(deliverytimerequestdo deliverytimerequestdo){ deliverytimeentity deliverytimeentity = new deliverytimeentity(); deliverytimeentity.settime(deliverytimerequestdo.getdeliverytime()); deliverytimerequestdo deliverytentity = deliverytimerepository.save(deliverytimerequestdo); return deliverytentity;
}
implementation manager
public deliverytimerequestdo insert(deliverytimerequestdo deliverytimerequestdo){ deliverytimerequestdo deliverytimeredo = deliverytimeaccessmanager.create(deliverytimerequestdo); return deliverytimeredo; }
controller
@postmapping public deliverytimeaddresponsedto adddeliverytime(deliverytimeaddrequestdto deliverytimeaddrequestdto){ deliverytimeaddresponsedto deliverytimeaddresponsedto = new deliverytimeaddresponsedto(); //deliverytimerequestdo deliverytimerequestdo = new deliverytimerequestdo(); deliverytimerequestdo deliverytimerequestdo = deliverytimemanagerimpl.insert(deliverytimerequestdo.getdeliverytime()); deliverytimerequestdo.setdeliverytime(deliverytimeaddrequestdto.getdeliverytime()); deliverytimeaddresponsedto.setsuccess(true); return deliverytimeaddresponsedto; }
are u getting dataintegrityviolationexception jpa ? kindly confirm ?
Comments
Post a Comment