在 Spring Boot 中使用 ORM 处理 GEOJSON 文件

问题描述 投票:0回答:1

我有一个名为 abc.json 的 GEOJSON 文件

{
    "type": "FeatureCollection",
    "features": [
        {
            "type": "Feature",
            "geometry": {
                "type": "Point",
                "coordinates": [
                    -8.5,
                    40.9
                ]
            },
            "properties": {
                "parameters": {
                    "id": "1",
                    "name": "Jethalal",
                    "employeeId": "Jethalal",
                    "category": "account"
                }
            }
        },
        {
            "type": "Feature",
            "geometry": {
                "type": "Point",
                "coordinates": [
                    -9.1,
                    41.5
                ]
            },
            "properties": {
                "parameters": {
                    "id": "2",
                    "name": "Atmaram",
                    "employeeId": "Atmaram",
                    "category": "sales"
                }
            }
        }
    ]
}

我想知道是否存在ORM来处理GEOJSON文件中的大数据

示例 - 我想将“类别”字段更新为“购买”Jethalal。我将调用一个更新方法。

Feature feature = jsonRepository.findById(1);
feature.setCategory("purchase");
jsonRepository.save(feature);

我的文件看起来像这样

{
    "type": "FeatureCollection",
    "features": [
        {
            "type": "Feature",
            "geometry": {
                "type": "Point",
                "coordinates": [
                    -8.5,
                    40.9
                ]
            },
            "properties": {
                "parameters": {
                    "id": "1",
                    "name": "Jethalal",
                    "employeeId": "Jethalal",
                    "category": "purchase"
                }
            }
        },
        {
            "type": "Feature",
            "geometry": {
                "type": "Point",
                "coordinates": [
                    -9.1,
                    41.5
                ]
            },
            "properties": {
                "parameters": {
                    "id": "2",
                    "name": "Atmaram",
                    "employeeId": "Atmaram",
                    "category": "sales"
                }
            }
        }
    ]
}

我知道类似的图书馆

  1. 杰克逊
  2. GSON
  3. json-简单 但所有这些库首先以对象的形式获取整个文件数据,然后允许对其执行操作。 我想在不获取整个文件数据的情况下进行操作。
java json hibernate file orm
1个回答
0
投票

您可以使用Hibernate动态更新来更新JSON字段。这是参考。

https://vladmihalcea.com/hibernate-dynamic-update-json-properties/

© www.soinside.com 2019 - 2024. All rights reserved.