[英]How to manipulate data object and save into Spring JPA in effective way?
How can i save the manipulated object and other object after the "Transaction.builder" at below code in effective way ? 如何以有效方式在下面的代码“ Transaction.builder”之后保存操作对象和其他对象?
Is there any other way for me to set all the object in the builder rather than only the object that i want to ? 我还有其他方法可以设置生成器中的所有对象,而不仅仅是我想要的对象吗?
(FYI: I have entity class with hundred of object) (仅供参考:我有带有数百个对象的实体类)
ProcessingError error = new ProcessingError("Tag Serial Num and Vehicle Plate Num are empty",
ResponseStatus.TAG_SERIAL_NUM_VEHICLE_PLATE_NUM_NOT_EXISTS,
TransactionRule.VALIDATE_TAG_SERIAL_NUM_VEHICLE_PLATE_NUM);
log.info("Transaction before builder :{}",transaction.getTcTransactionId());
transaction = Transaction.builder()
.responseStatus(error.getResponseStatus())
.failedErrorRule(error.getTransactionRule())
.build();
log.info("Transaction after builder :{}",transaction.getTcTransactionId());
Ref full code at top: 在顶部引用完整的代码:
log shown in the code before using builder: 使用构建器之前,在代码中显示日志:
Transaction before builder :"test01"
After Log shown in the code after using builder 使用构建器后代码中显示的日志之后
Transaction after builder :null
Remove the builder and just straight set the variable such as in below code: 删除构建器,然后直接设置变量,如下面的代码所示:
transaction.setResponseStatus(error.getResponseStatus());
transaction.setFailedErrorRule(error.getTransactionRule());
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.