升级到 Hibernate 5.6.0.Final 后,我发现 org.hibernate.annotations.Type 现已弃用。我在许多实体中使用此注释,包括我利用 Hibernate 自己的 NumericBooleanType 的地方:
@Type(type = "org.hibernate.type.NumericBooleanType")
private Boolean debug = false;
Run Code Online (Sandbox Code Playgroud)
我搜索了 Hibernate 文档(迁移指南 - 其中 6.0 版本从http://hibernate.org/orm/documentation/6.0/给了我一个 404 )、Javadocs、论坛和网络来寻找替代品,但没有找到有用。
有谁知道我现在可以在 Hibernate 5.6.0 中做什么来使用类型注释准备我的代码以过渡到 Hibernate 6?
我有以下控制器
@RequestMapping(value = "/update/{tableId}", method = RequestMethod.PUT, produces = MediaType.APPLICATION_JSON_VALUE,
consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity updateItemQty (@PathVariable Long tableId, @RequestBody AddItemsRequestBody requestBody,
HttpServletRequest request){
try {
String addedBy = getUserName(request);
Float ItemQuantity = requestBody.getItemQuantity();
LocalDateTime dateTimeAdded = LocalDateTime.now();
String subId = requestBody.getItemSubId();
ArrayList<ItemAdditionDetails> updatedAdditionDetails = new ArrayList<>();
ItemAdditionDetails newItemAdditionDetails = new ItemAdditionDetails();
newItemAdditionDetails.setIncreamentCount(ItemQuantity);
newItemAdditionDetails.setAddedDateTime(dateTimeAdded);
newItemAdditionDetails.setAddedBy(addedBy);
updatedAdditionDetails.add(newItemAdditionDetails);
// Here i am fetching a JSON-B column that returns an array of json objects from Postgress DB
ItemInventoryService.findByItemSubId(subId).getItemsInventoryAdditionDetails().forEach((el) -> {
updatedAdditionDetails.add(el);
});
itemInventoryService.updateItemsAdditionDetails(subId,updatedAdditionDetails); …Run Code Online (Sandbox Code Playgroud)