i have given all correct values. while creating i am not facing any problem.
在更新时我遇到问题// model` @短暂的 // @ Range(min = 0,message =“ SHIPMENT_COST_STR_POSITIVE”) @NotEmpty(message =“ SHIPMENT_COST_STR_NULL”) 私有字符串shippingCostStr; @短暂的 // @ Range(min = 0,message =“ SH_ORDER_START_PRICE_POSITIVE”) @NotEmpty(message =“ SH_ORDER_START_PRICE_NULL”) 私有字符串orderStartPriceStr; @短暂的 // @ Range(min = 0,message =“ SH_ORDER_END_PRICE_POSITIVE”) @NotEmpty(message =“ SH_ORDER_END_PRICE_NULL”) 私有字符串orderEndPriceStr; @短暂的 // @ Range(min = 0,message =“ SH_ORDER_QUANTITY_START_VALUE_POSITIVE”) @NotEmpty(message =“ SH_ORDER_QUANTITY_START_VALUE_NULL”) 私有字符串orderQuantityStartValueStr; @短暂的 // @ Range(min = 0,message =“ SH_ORDER_QUANTITY_END_VALUE_POSITIVE”) @NotEmpty(message =“ SH_ORDER_QUANTITY_END_VALUE_NULL”) 私有字符串orderQuantityEndValueStr; @短暂的 // @ Range(min = 0,message =“ SH_WEIGHT_START_RANGE_VALUE_POSITIVE”) @NotEmpty(message =“ SH_WEIGHT_START_RANGE_VALUE_NULL”) 私有字符串weightStartRangeValueStr; @短暂的 // @ Range(min = 0,message =“ SH_WEIGHT_END_RANGE_VALUE_POSITIVE”) @NotEmpty(message =“ SH_WEIGHT_END_RANGE_VALUE_NULL”) 私有字符串weightEndRangeValueStr; @短暂的 // @ Range(min = 0,message =“ SH_DISTANT_START_RANGE_VALUE_POSITIVE”) @NotEmpty(message =“ SH_DISTANT_START_RANGE_VALUE_NULL”) private String distanceStartRangeValueStr; @短暂的 // @ Range(min = 0,message =“ SH_DISTANT_END_RANGE_VALUE_POSITIVE”) @NotEmpty(message =“ SH_DISTANT_END_RANGE_VALUE_NULL”) 私有String distanceEndRangeValueStr;
Dao layer:`enter code here`
session= sessionFactory.openSession();
transaction=session.beginTransaction();
shipmentObj.setSno(Integer.parseInt(shipmentObj.getSnoStr()));
ShipmentRateMaster masterObj=(ShipmentRateMaster) session.get(ShipmentRateMaster.class, shipmentObj.getSno());
if(masterObj!=null){
if(shipmentObj.getShipmentCostStr()!=null&&!shipmentObj.getShipmentCostStr().equals(Utilities.getMessage("RM_EMPTY_STRING"))){
shipmentObj.setShipmentCost(Float.valueOf(shipmentObj.getShipmentCostStr()));}
if(shipmentObj.getOrderStartPriceStr()!=null&&!shipmentObj.getOrderStartPriceStr().equals(Utilities.getMessage("RM_EMPTY_STRING"))){
shipmentObj.setOrderStartPrice(Float.valueOf(shipmentObj.getOrderStartPriceStr()));}
if(shipmentObj.getOrderEndPriceStr()!=null&&!shipmentObj.getOrderEndPriceStr().equals(Utilities.getMessage("RM_EMPTY_STRING"))){
shipmentObj.setOrderEndPrice(Float.valueOf(shipmentObj.getOrderEndPriceStr()));}
if(shipmentObj.getOrderQuantityStartValueStr()!=null&&!shipmentObj.getOrderQuantityStartValueStr().equals(Utilities.getMessage("RM_EMPTY_STRING"))){
shipmentObj.setOrderQuantityStartValue(Float.valueOf(shipmentObj.getOrderQuantityStartValueStr()));}
if(shipmentObj.getOrderQuantityEndValueStr()!=null&&!shipmentObj.getOrderQuantityEndValueStr().equals(Utilities.getMessage("RM_EMPTY_STRING"))){
shipmentObj.setOrderQuantityEndValue(Float.valueOf(shipmentObj.getOrderQuantityEndValueStr())); }
if(shipmentObj.getWeightStartRangeValueStr()!=null&&!shipmentObj.getWeightStartRangeValueStr().equals(Utilities.getMessage("RM_EMPTY_STRING"))){
shipmentObj.setWeightStartRangeValue(Float.valueOf(shipmentObj.getWeightStartRangeValueStr()));}
if(shipmentObj.getWeightEndRangeValueStr()!=null&&!shipmentObj.getWeightEndRangeValueStr().equals(Utilities.getMessage("RM_EMPTY_STRING"))){
shipmentObj.setWeightEndRangeValue(Float.valueOf(shipmentObj.getWeightEndRangeValueStr())); }
if(shipmentObj.getDistanceStartRangeValueStr()!=null&&!shipmentObj.getDistanceStartRangeValueStr().equals(Utilities.getMessage("RM_EMPTY_STRING"))){
shipmentObj.setDistanceStartRangeValue(Float.valueOf(shipmentObj.getDistanceStartRangeValueStr()));}
if(shipmentObj.getDistanceEndRangeValueStr()!=null&&!shipmentObj.getDistanceEndRangeValueStr().equals(Utilities.getMessage("RM_EMPTY_STRING"))){
shipmentObj.setDistanceEndRangeValue(Float.valueOf(shipmentObj.getDistanceEndRangeValueStr())); }
session.merge(shipmentObj);
transaction.commit();
at java.lang.Thread.run(Thread.java:748)
javax.validation.ConstraintViolationException: Validation failed for classes [com.tlabs.omniretailerservices.models.ShipmentRateMaster] during update time for groups [javax.validation.groups.Default, ]
List of constraint violations:[
ConstraintViolationImpl{interpolatedMessage='SH_WEIGHT_END_RANGE_VALUE_NULL', propertyPath=weightEndRangeValueStr, rootBeanClass=class com.tlabs.omniretailerservices.models.ShipmentRateMaster, messageTemplate='SH_WEIGHT_END_RANGE_VALUE_NULL'}
ConstraintViolationImpl{interpolatedMessage='SH_DISTANT_START_RANGE_VALUE_NULL', propertyPath=distanceStartRangeValueStr, rootBeanClass=class com.tlabs.omniretailerservices.models.ShipmentRateMaster, messageTemplate='SH_DISTANT_START_RANGE_VALUE_NULL'}
ConstraintViolationImpl{interpolatedMessage='SH_ORDER_END_PRICE_NULL', propertyPath=orderEndPriceStr, rootBeanClass=class com.tlabs.omniretailerservices.models.ShipmentRateMaster, messageTemplate='SH_ORDER_END_PRICE_NULL'}
ConstraintViolationImpl{interpolatedMessage='SH_ORDER_START_PRICE_NULL', propertyPath=orderStartPriceStr, rootBeanClass=class com.tlabs.omniretailerservices.models.ShipmentRateMaster, messageTemplate='SH_ORDER_START_PRICE_NULL'}
ConstraintViolationImpl{interpolatedMessage='SH_ORDER_QUANTITY_END_VALUE_NULL', propertyPath=orderQuantityEndValueStr, rootBeanClass=class com.tlabs.omniretailerservices.models.ShipmentRateMaster, messageTemplate='SH_ORDER_QUANTITY_END_VALUE_NULL'}
ConstraintViolationImpl{interpolatedMessage='SH_ORDER_QUANTITY_START_VALUE_NULL', propertyPath=orderQuantityStartValueStr, rootBeanClass=class com.tlabs.omniretailerservices.models.ShipmentRateMaster, messageTemplate='SH_ORDER_QUANTITY_START_VALUE_NULL'}
ConstraintViolationImpl{interpolatedMessage='SH_WEIGHT_START_RANGE_VALUE_NULL', propertyPath=weightStartRangeValueStr, rootBeanClass=class com.tlabs.omniretailerservices.models.ShipmentRateMaster, messageTemplate='SH_WEIGHT_START_RANGE_VALUE_NULL'}
ConstraintViolationImpl{interpolatedMessage='SH_DISTANT_END_RANGE_VALUE_NULL', propertyPath=distanceEndRangeValueStr, rootBeanClass=class com.tlabs.omniretailerservices.models.ShipmentRateMaster, messageTemplate='SH_DISTANT_END_RANGE_VALUE_NULL'}
ConstraintViolationImpl{interpolatedMessage='SHIPMENT_COST_STR_NULL', propertyPath=shipmentCostStr, rootBeanClass=class com.tlabs.omniretailerservices.models.ShipmentRateMaster, messageTemplate='SHIPMENT_COST_STR_NULL'}
]
at org.hibernate.cfg.beanvalidation.BeanValidationEventListener.validate(BeanValidationEventListener.java:161)
at org.hibernate.cfg.beanvalidation.BeanValidationEventListener.onPreUpdate(BeanValidationEventListener.java:102)
at org.hibernate.action.EntityUpdateAction.preUpdate(EntityUpdateAction.java:237)
at org.hibernate.action.EntityUpdateAction.execute(EntityUpdateAction.java:86)
at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:273)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:265)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:185)
at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:321)
at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:51)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1216)
at com.tlabs.omniretailerservices.dao.ShipmentRateDao.updateShipmentRate(ShipmentRateDao.java:622)
at com.tlabs.omniretailerservices.implementations.ShipmentRateServiceImpl.updateShipmentRate(ShipmentRateServiceImpl.java:302)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.cxf.service.invoker.AbstractInvoker.performInvocation(AbstractInvoker.java:180)
at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:96)
at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:165)
at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:89)
at org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:57)
at org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:93)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:263)
at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121)
at org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:237)
at org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:239)
at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:213)
at org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:131)
at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:266)
at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPost(AbstractHTTPServlet.java:186)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:648)
at org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:242)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:292)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:212)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:616)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:522)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1095)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:672)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1502)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1458)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:748)