Spring Data Neo4j导入时速度很慢

时间:2012-12-12 14:32:23

标签: neo4j spring-data-neo4j

有人可以向我解释为什么将实体导入Neo4j需要6到10秒?

我正在使用Spring Data Neo4j和一个自定义存储库,它有Neo4jTemplate @Autowire - d。所以当我坚持一个实体时,我打电话给template.save(entity)。 我不得不说,虽然实体有点沉重。它有47个属性,即字段,其中3个标有@Indexed注释,其中10个是标有@RelatedTo的其他自定义实体。 @RelatedTo字段中有5个属于Set类型。这意味着实际上在导入这个重型实体时,另外10-15个实体也可能会被持久化并连接到它。

这是实际问题还是我能做些什么可以加快这个过程?

我环顾四周找到BatchInserter,但它没有处理索引。我找到了this示例实现,但如果没有其他选项,我会尝试它。

所以我想我想要了解的是,如果重型实体是持续缓慢的原因或其他原因。

我正在使用Neo4j 1.8并且没有触及配置文件。

感谢任何帮助。感谢。

修改
@Michael Hunger:
- 数据库中的数据量似乎没有效果 - 我没有使用AspectJ,所以我猜我正在使用简单的映射,对吧?你认为我会用AspectJ获得更好的表现吗? - 我认为我没有跨越save方法的外部事务。我正在使用Wicket Web应用程序中的数据库。如果我将Neo4j的REST API与例如 Jersey REST客户端一起使用会更好吗?
- 如果自定义类型的类中存在属性,例如Area area,然后将为此area自动创建另一个节点以及主节点与area之间的连接,对吗?所以不需要template.createRelationshipBetween(entity1, entity2, type, properties, true),对吗?要使用它,我需要做的是删除area属性,然后使用一些索引查找正确的area,然后手动建立连接。那是你的意思吗?

这就是我的保存方法的样子:

@Override
@Neo4jTransactional
public <T extends Identifiable> T save(T entity) {
    T saved = template.save(entity);
    Long savedId = saved.getId();
    Node savedNode = getNode(savedId);
    connectToContainerNode(savedNode, entity.getClass());

    return saved;
}

以下是如何定义实体的示例(忽略@ExcelCell注释)。通常有一个由持久化实体扩展的抽象类。如果我做错了,请告诉我。

@NodeEntity
@SuppressWarnings("rawtypes")
public abstract class Building  implements Identifiable {
    @GraphId private Long id;

    @ExcelCell( type={NewBuilding.class, RefurbishedBuilding.class, ReferenceBuilding.class}, cell=8, sheet=0, row=10)
    @Fetch

    private String concertoId;


    @Fetch
    @Indexed(indexName = "concertoUniqueId", indexType = IndexType.FULLTEXT) 
    private String concertoUniqueId;


    @Fetch
    @Indexed(indexName = "filename", indexType = IndexType.FULLTEXT) 
    private String filename;

    @ExcelCells({
    @ExcelCell( type={NewBuilding.class}, cell=7, sheet=1, row=56),
    @ExcelCell( type={ReferenceBuilding.class}, cell=7, sheet=1, row=40),
    @ExcelCell( type={RefurbishedBuilding.class}, cell=8, sheet=1, row=75),
    })
    @Fetch

    private Double floorAreaAccordingToLocalDefinition;


    @Fetch

    private Double formulaCAP;


    @Fetch

    private HashMap formulaEFecmdirectMatrix;


    @Fetch

    private HashMap formulaEFecmindirectMatrix;


    @Fetch

    private Double formulaEM;


    @Fetch

    private Double formulaEN;


    @Fetch

    private Double formulaIN;


    @Fetch

    private HashMap formulaINecaaMatrix;


    @Fetch

    private Double formulaInvestmentAdditionalCosts;


    @Fetch

    private Double formulaInvestmentTotalCosts;

    @ExcelCells({
    @ExcelCell( type={NewBuilding.class}, cell=6, sheet=1, row=13),
    @ExcelCell( type={ReferenceBuilding.class}, cell=6, sheet=1, row=21),
    @ExcelCell( type={RefurbishedBuilding.class}, cell=6, sheet=1, row=22),
    })
    @Fetch
    @Indexed(indexName = "name", indexType = IndexType.FULLTEXT) 
    private String name;

    @ExcelCells({
    @ExcelCell( type={NewBuilding.class}, cell=7, sheet=1, row=55),
    @ExcelCell( type={ReferenceBuilding.class}, cell=7, sheet=1, row=39),
    @ExcelCell( type={RefurbishedBuilding.class}, cell=8, sheet=1, row=74),
    })
    @Fetch

    private Double rentableArea;

    @ExcelCells({
    @ExcelCell( type={NewBuilding.class}, cell=7, sheet=1, row=54),
    @ExcelCell( type={ReferenceBuilding.class}, cell=7, sheet=1, row=38),
    @ExcelCell( type={RefurbishedBuilding.class}, cell=8, sheet=1, row=73),
    })
    @Fetch

    private Double totalCooledNetRoomArea;

    @ExcelCells({
    @ExcelCell( type={NewBuilding.class}, cell=7, sheet=1, row=52),
    @ExcelCell( type={ReferenceBuilding.class}, cell=7, sheet=1, row=36),
    @ExcelCell( type={RefurbishedBuilding.class}, cell=8, sheet=1, row=71),
    })
    @Fetch

    private Double totalGrossFloorArea;

    @ExcelCells({
    @ExcelCell( type={NewBuilding.class}, cell=7, sheet=1, row=53),
    @ExcelCell( type={ReferenceBuilding.class}, cell=7, sheet=1, row=37),
    @ExcelCell( type={RefurbishedBuilding.class}, cell=8, sheet=1, row=72),
    })
    @Fetch

    private Double totalHeatedNetRoomArea;


    @ExcelRef
    @RelatedTo(type = "area", elementClass = Area.class, direction=Direction.BOTH)

    private Area area;

    @ExcelRef
    @RelatedTo(type = "community", elementClass = Community.class, direction=Direction.BOTH)

    private Community community;

    @ExcelRef
    @RelatedTo(type = "costsForTheEntireBuilding", elementClass = CostsForTheEntireBuilding.class, direction=Direction.BOTH)

    private CostsForTheEntireBuilding costsForTheEntireBuilding;

    @ExcelRef
    @RelatedTo(type = "country", elementClass = Country.class, direction=Direction.BOTH)

    private Country country;

    @ExcelRef
    @RelatedTo(type = "project", elementClass = Project.class, direction=Direction.BOTH)

    private Project project;



    @RelatedTo(type = "costsForSelectedMeasuresOfBuilding", elementClass = CostsForSelectedMeasuresOfBuilding.class, direction=Direction.BOTH)

    private Set<CostsForSelectedMeasuresOfBuilding> costsForSelectedMeasuresOfBuilding = new LinkedHashSet<CostsForSelectedMeasuresOfBuilding>();


    @RelatedTo(type = "groupCostsOfBuildings", elementClass = GroupCostsOfBuilding.class, direction=Direction.BOTH)

    private Set<GroupCostsOfBuilding> groupCostsOfBuildings = new LinkedHashSet<GroupCostsOfBuilding>();


    @RelatedTo(type = "individualCostsOfBuilding", elementClass = IndividualCostsOfBuilding.class, direction=Direction.BOTH)

    private Set<IndividualCostsOfBuilding> individualCostsOfBuilding = new LinkedHashSet<IndividualCostsOfBuilding>();


    public Building(){}

    // getters and setters ommitted
}

这是NewBuilding类,它扩展了抽象的Building类,并且保存在DB中。

@NodeEntity

public class NewBuilding extends Building  {


    @ExcelCell( type={}, cell=6, sheet=1, row=38)
    @Fetch

    private String applicableThresholdUnit;

    @ExcelCell( type={}, cell=7, sheet=1, row=38)
    @Fetch

    private String applicableThresholdValue;

    @ExcelDropdown(sheet=1, ids={1111})


    private AtticType atticType;

    @ExcelCell( type={}, cell=7, sheet=1, row=67)
    @Fetch

    private Double averageEnergyTransmittanceOfWindowsAccordingToRequirements;

    @ExcelCell( type={}, cell=8, sheet=1, row=67)
    @Fetch

    private Double averageEnergyTransmittanceOfWindowsRealised;

    @ExcelCell( type={}, cell=7, sheet=1, row=64)
    @Fetch

    private Double averageHTCFacadeAccordingToRequirements;

    @ExcelCell( type={}, cell=10, sheet=1, row=64)
    @Fetch

    private Double averageHTCFacadeBuildingEnvelopeSurfaces;

    @ExcelCell( type={}, cell=8, sheet=1, row=64)
    @Fetch

    private Double averageHTCFacadeRealised;

    @ExcelCell( type={}, cell=7, sheet=1, row=65)
    @Fetch

    private Double averageHTCGroundFloorAccordingToRequirements;

    @ExcelCell( type={}, cell=10, sheet=1, row=65)
    @Fetch

    private Double averageHTCGroundFloorBuildingEnvelopeSurfaces;

    @ExcelCell( type={}, cell=8, sheet=1, row=65)
    @Fetch

    private Double averageHTCGroundFloorRealised;

    @ExcelCell( type={}, cell=7, sheet=1, row=63)
    @Fetch

    private Double averageHTCRoofAccordingToRequirements;

    @ExcelCell( type={}, cell=10, sheet=1, row=63)
    @Fetch

    private Double averageHTCRoofBuildingEnvelopeSurfaces;

    @ExcelCell( type={}, cell=8, sheet=1, row=63)
    @Fetch

    private Double averageHTCRoofRealised;

    @ExcelCell( type={}, cell=7, sheet=1, row=66)
    @Fetch

    private Double averageHTCWindowsAccordingToRequirements;

    @ExcelCell( type={}, cell=10, sheet=1, row=66)
    @Fetch

    private Double averageHTCWindowsFloorBuildingEnvelopeSurfaces;

    @ExcelCell( type={}, cell=8, sheet=1, row=66)
    @Fetch

    private Double averageHTCWindowsFloorRealised;

    @ExcelDropdown(sheet=1, ids={1110})


    private BasementType basementType;

    @ExcelDropdown(sheet=1, ids={1636}, type={NewBuilding.class, })


    private BuildingIsOwnedOrRented buildingIsOwnedOrRented;

    @ExcelDropdown(sheet=1, ids={1635}, type={NewBuilding.class, })


    private BuildingIsPrivateOrPublic buildingIsPrivateOrPublic;

    @ExcelDropdown(sheet=1, ids={1112})


    private BuildingType buildingType;

    @ExcelCell( type={}, cell=10, sheet=1, row=73)
    @Fetch

    private Double calculatedFinalEnergyDemandForCoolingElectricity;

    @ExcelCell( type={}, cell=11, sheet=1, row=73)
    @Fetch

    private Double calculatedFinalEnergyDemandForCoolingNonElectricity;

    @ExcelCell( type={}, cell=8, sheet=1, row=73)
    @Fetch

    private Double calculatedFinalEnergyDemandForDomesticHotWaterElectricity;

    @ExcelCell( type={}, cell=9, sheet=1, row=73)
    @Fetch

    private Double calculatedFinalEnergyDemandForDomesticHotWaterNonElectricity;

    @ExcelCell( type={}, cell=6, sheet=1, row=73)
    @Fetch

    private Double calculatedFinalEnergyDemandForHeatingElectricity;

    @ExcelCell( type={}, cell=7, sheet=1, row=73)
    @Fetch

    private Double calculatedFinalEnergyDemandForHeatingNonElectricity;

    @ExcelCell( type={}, cell=10, sheet=1, row=72)
    @Fetch

    private Double calculatedFinalEnergyDemandOfRefBuildingForCoolingElectricity;

    @ExcelCell( type={}, cell=11, sheet=1, row=72)
    @Fetch

    private Double calculatedFinalEnergyDemandOfRefBuildingForCoolingNonElectricity;

    @ExcelCell( type={}, cell=8, sheet=1, row=72)
    @Fetch

    private Double calculatedFinalEnergyDemandOfRefBuildingForDomesticHotWaterElectricity;

    @ExcelCell( type={}, cell=9, sheet=1, row=72)
    @Fetch

    private Double calculatedFinalEnergyDemandOfRefBuildingForDomesticHotWaterNonElectricity;

    @ExcelCell( type={}, cell=6, sheet=1, row=72)
    @Fetch

    private Double calculatedFinalEnergyDemandOfRefBuildingForHeatingElectricity;

    @ExcelCell( type={}, cell=7, sheet=1, row=72)
    @Fetch

    private Double calculatedFinalEnergyDemandOfRefBuildingForHeatingNonElectricity;

    @ExcelCell( type={}, cell=12, sheet=1, row=72)
    @Fetch

    private Double calculatedFinalEnergyDemandOfRefBuildingForLightingAndOther;

    @ExcelCell( type={}, cell=6, sheet=1, row=20 ,textToIgnore="month/year")
    @Fetch

    private String completionDate;

    @ExcelCheckboxYesNo(sheet=1, yesId=1222, noId=1223)
    @Fetch

    private boolean contractingAgreementExists;

    @ExcelCell( type={}, cell=7, sheet=1, row=40 ,textToIgnore="Remarks")
    @Fetch

    private String contractingAgreementRemarks;

    @ExcelDropdown(sheet=1, ids={751}, type={NewBuilding.class, })


    private DemonstrationActivityScheme demonstrationActivityScheme;

    @ExcelCell( type={NewBuilding.class}, cell=2, sheet=5, row=11)
    @Fetch

    private Date endDateOfMonitoringPeriod;

    @ExcelCell( type={NewBuilding.class}, cell=10, sheet=1, row=73)
    @Fetch

    private Double energyDemandCoolingElectricityConcerto;

    @ExcelCell( type={NewBuilding.class}, cell=10, sheet=1, row=72)
    @Fetch

    private Double energyDemandCoolingElectricityNational;

    @ExcelCell( type={NewBuilding.class}, cell=11, sheet=1, row=73)
    @Fetch

    private Double energyDemandCoolingNonElectricityConcerto;

    @ExcelCell( type={NewBuilding.class}, cell=11, sheet=1, row=72)
    @Fetch

    private Double energyDemandCoolingNonElectricityNational;

    @ExcelCell( type={NewBuilding.class}, cell=8, sheet=1, row=73)
    @Fetch

    private Double energyDemandDomesticHotWaterElectricityConcerto;

    @ExcelCell( type={NewBuilding.class}, cell=8, sheet=1, row=72)
    @Fetch

    private Double energyDemandDomesticHotWaterElectricityNational;

    @ExcelCell( type={NewBuilding.class}, cell=9, sheet=1, row=73)
    @Fetch

    private Double energyDemandDomesticHotWaterNonElectricityConcerto;

    @ExcelCell( type={NewBuilding.class}, cell=9, sheet=1, row=72)
    @Fetch

    private Double energyDemandDomesticHotWaterNonElectricityNational;

    @ExcelCell( type={NewBuilding.class}, cell=6, sheet=1, row=73)
    @Fetch

    private Double energyDemandHeatingElectricityConcerto;

    @ExcelCell( type={NewBuilding.class}, cell=6, sheet=1, row=72)
    @Fetch

    private Double energyDemandHeatingElectricityNational;

    @ExcelCell( type={NewBuilding.class}, cell=7, sheet=1, row=73)
    @Fetch

    private Double energyDemandHeatingNonElectricityConcerto;

    @ExcelCell( type={NewBuilding.class}, cell=7, sheet=1, row=72)
    @Fetch

    private Double energyDemandHeatingNonElectricityNational;

    @ExcelCell( type={NewBuilding.class}, cell=12, sheet=1, row=73)
    @Fetch

    private Double energyDemandLightingAndAllOtherElectricityConcerto;

    @ExcelCell( type={NewBuilding.class}, cell=12, sheet=1, row=72)
    @Fetch

    private Double energyDemandLightingAndAllOtherElectricityNational;

    @ExcelCheckboxYesNo(sheet=1, yesId=1188, noId=1189)
    @Fetch

    private boolean energyPerformanceCertificate;

    @ExcelDropdown(sheet=1, ids={1103})


    private EnergyPerformanceIndicatorRefersTo energyPerformanceIndicatorRefersTo;

    @ExcelCell( type={}, cell=8, sheet=1, row=90 ,textToIgnore="specify capacity")
    @Fetch

    private String energyStorageCoolingCapacity;

    @ExcelCell( type={}, cell=10, sheet=1, row=90 ,textToIgnore="Remarks")
    @Fetch

    private String energyStorageCoolingRemarks;

    @ExcelDropdown(sheet=1, ids={2024})


    private CapacityUnit energyStorageCoolingUnit;

    @ExcelCheckbox(sheet=1, ids={1375})
    @Fetch

    private boolean energyStorageCoolingUsed;

    @ExcelCell( type={}, cell=8, sheet=1, row=89 ,textToIgnore="specify capacity")
    @Fetch

    private String energyStorageDHWCapacity;

    @ExcelCell( type={}, cell=10, sheet=1, row=89 ,textToIgnore="Remarks")
    @Fetch

    private String energyStorageDHWRemarks;

    @ExcelDropdown(sheet=1, ids={2023})


    private CapacityUnit energyStorageDHWUnit;

    @ExcelCheckbox(sheet=1, ids={1371})
    @Fetch

    private boolean energyStorageDHWUsed;

    @ExcelCell( type={}, cell=8, sheet=1, row=91 ,textToIgnore="specify capacity")
    @Fetch

    private String energyStorageElectricalCapacity;

    @ExcelCell( type={}, cell=10, sheet=1, row=91 ,textToIgnore="Remarks")
    @Fetch

    private String energyStorageElectricalRemarks;

    @ExcelDropdown(sheet=1, ids={2025})


    private CapacityUnit energyStorageElectricalUnit;

    @ExcelCheckbox(sheet=1, ids={1469})
    @Fetch

    private boolean energyStorageElectricalUsed;

    @ExcelCell( type={}, cell=8, sheet=1, row=88 ,textToIgnore="specify capacity")
    @Fetch

    private String energyStorageSpaceHeatingCapacity;

    @ExcelCell( type={}, cell=10, sheet=1, row=88 ,textToIgnore="Remarks")
    @Fetch

    private String energyStorageSpaceHeatingRemarks;

    @ExcelDropdown(sheet=1, ids={2022})


    private CapacityUnit energyStorageSpaceHeatingUnit;

    @ExcelCheckbox(sheet=1, ids={1370})
    @Fetch

    private boolean energyStorageSpaceHeatingUsed;

    @ExcelCell( type={}, cell=8, sheet=1, row=87 ,textToIgnore="specify capacity")
    @Fetch

    private String energyStorageThermalCapacity;

    @ExcelCell( type={}, cell=10, sheet=1, row=87 ,textToIgnore="Remarks")
    @Fetch

    private String energyStorageThermalRemarks;

    @ExcelDropdown(sheet=1, ids={2021})


    private CapacityUnit energyStorageThermalUnit;

    @ExcelCheckbox(sheet=1, ids={1367})
    @Fetch

    private boolean energyStorageThermalUsed;


    @Fetch

    private Double formulaPEFec;


    @Fetch

    private Double formulaPEN;

    @ExcelCheckbox(sheet=1, ids={2041})
    @Fetch

    private boolean indicatorContainsCooling;

    @ExcelCell( type={}, cell=6, sheet=1, row=35)
    @Fetch

    private String indicatorContainsCoolingUnit;

    @ExcelCell( type={}, cell=7, sheet=1, row=35)
    @Fetch

    private String indicatorContainsCoolingValue;

    @ExcelCheckbox(sheet=1, ids={2040})
    @Fetch

    private boolean indicatorContainsDomesticHotWaterProduction;

    @ExcelCell( type={}, cell=6, sheet=1, row=34)
    @Fetch

    private String indicatorContainsDomesticHotWaterProductionUnit;

    @ExcelCell( type={}, cell=7, sheet=1, row=34)
    @Fetch

    private String indicatorContainsDomesticHotWaterProductionValue;

    @ExcelCheckbox(sheet=1, ids={2042})
    @Fetch

    private boolean indicatorContainsLighting;

    @ExcelCell( type={}, cell=6, sheet=1, row=37)
    @Fetch

    private String indicatorContainsLightingUnit;

    @ExcelCell( type={}, cell=7, sheet=1, row=37)
    @Fetch

    private String indicatorContainsLightingValue;

    @ExcelCheckbox(sheet=1, ids={2039})
    @Fetch

    private boolean indicatorContainsSpaceHeating;

    @ExcelCell( type={}, cell=6, sheet=1, row=33)
    @Fetch

    private String indicatorContainsSpaceHeatingUnit;

    @ExcelCell( type={}, cell=7, sheet=1, row=33)
    @Fetch

    private String indicatorContainsSpaceHeatingValue;

    @ExcelCheckbox(sheet=1, ids={2038})
    @Fetch

    private boolean indicatorContainsVentilation;

    @ExcelCell( type={}, cell=6, sheet=1, row=36)
    @Fetch

    private String indicatorContainsVentilationUnit;

    @ExcelCell( type={}, cell=7, sheet=1, row=36)
    @Fetch

    private String indicatorContainsVentilationValue;

    @ExcelCell( type={NewBuilding.class}, cell=6, sheet=1, row=14)
    @Fetch

    private String location;

    @ExcelDropdown(sheet=1, ids={1101})


    private MainCharacteristicsOfCertificate1 mainCharacteristicsOfCertificate1;

    @ExcelDropdown(sheet=1, ids={1102})


    private MainCharacteristicsOfCertificate2 mainCharacteristicsOfCertificate2;

    @ExcelCell( type={}, cell=6, sheet=1, row=21)
    @Fetch

    private String nameOfAppliedBuildingCode;

    @ExcelCell( type={}, cell=6, sheet=1, row=27)
    @Fetch

    private String nameOfCertificate;

    @ExcelCell( type={}, cell=6, sheet=1, row=24)
    @Fetch

    private String networks;

    @ExcelCell( type={}, cell=6, sheet=1, row=48)
    @Fetch

    private String numberOfAppartmentsForResidentialBuilding;

    @ExcelCell( type={NewBuilding.class}, cell=6, sheet=1, row=18)
    @Fetch

    private String numberOfBuildingsRepresentedByThisBuilding;

    @ExcelCell( type={}, cell=6, sheet=1, row=49)
    @Fetch

    private String numberOfInhabitantsForResidentialBuilding;

    @ExcelCell( type={}, cell=6, sheet=1, row=50)
    @Fetch

    private String numberOfOccupantsForNonResidentialBuilding;

    @ExcelCell( type={}, cell=7, sheet=1, row=62)
    @Fetch

    private Double overallAverageHTCAccordingToRequirements;

    @ExcelCell( type={}, cell=10, sheet=1, row=62)
    @Fetch

    private Double overallAverageHTCBuildingEnvelopeSurfaces;

    @ExcelCell( type={}, cell=8, sheet=1, row=62)
    @Fetch

    private Double overallAverageHTCRealised;

    @ExcelDropdown(sheet=1, ids={1109})


    private PositionToNeighboringBuildings positionToNeighboringBuildings;

    @ExcelCell( type={NewBuilding.class}, cell=6, sheet=1, row=23 ,textToIgnore="id of reference building")
    @Fetch

    private String referenceBuildingId;

    @ExcelCell( type={}, cell=6, sheet=1, row=19 ,textToIgnore="month/year")
    @Fetch

    private String startDateOfConstructionWorks;

    @ExcelCell( type={NewBuilding.class}, cell=2, sheet=5, row=10)
    @Fetch

    private Date startDateOfMonitoringPeriod;

    @ExcelCheckboxYesNo(sheet=1, yesId=1443, noId=1444)
    @Fetch

    private boolean totalDomesticGasConsumptionIncludesGasForCooking;

    @ExcelCell( type={NewBuilding.class}, cell=7, sheet=1, row=58)
    @Fetch

    private Double totalGrossBuildingVolumeExternal;

    @ExcelCell( type={NewBuilding.class}, cell=7, sheet=1, row=60)
    @Fetch

    private Double totalNetCooledVolumeInternal;

    @ExcelCell( type={NewBuilding.class}, cell=7, sheet=1, row=59)
    @Fetch

    private Double totalNetHeatedVolumeInternal;

    @ExcelCell( type={}, cell=6, sheet=1, row=31)
    @Fetch

    private String unitOfIndicator;

    @ExcelCell( type={}, cell=7, sheet=1, row=31)
    @Fetch

    private String valueOfIndicator;

    @ExcelCell( type={}, cell=6, sheet=1, row=22 ,textToIgnore="year")
    @Fetch

    private String yearOfPublicationOfAppliedBuildingCode;


    @ExcelRef
    @RelatedTo(type = "characterisationOfAppliedBuildingFeatures", elementClass = CharacterisationOfAppliedBuildingFeatures.class, direction=Direction.BOTH)

    private CharacterisationOfAppliedBuildingFeatures characterisationOfAppliedBuildingFeatures;


    @ExcelCollection(type=BuildingEnergyService.class, start=0, end=5)
    @RelatedTo(type = "appliedEnergyServices", elementClass = BuildingEnergyService.class, direction=Direction.BOTH)

    private Set<BuildingEnergyService> appliedEnergyServices = new LinkedHashSet<BuildingEnergyService>();

    @ExcelCollection(type=MonitoringYearTotal.class, start=0, end=5, orientation=Orientation.SHEET)
    @RelatedTo(type = "monitoringYears", elementClass = MonitoringYearTotal.class, direction=Direction.BOTH)

    private Set<MonitoringYearTotal> monitoringYears = new LinkedHashSet<MonitoringYearTotal>();


    public NewBuilding(){}


    // getters and setters ommitted
}

1 个答案:

答案 0 :(得分:0)

  • 您能否分享您的实体或展示相同行为的示例项目?
  • 您的数据库中已有多少数据?
  • 您使用简单映射还是高级映射?
  • 您是否有跨save方法的外部交易?
  • 我认为您花在处理关系上的时间(SDN会对每个关系进行重复检查)您是否可以尝试替换那些跳过这些检查的template.createRelationshipBetween(entity1, entity2, type, properties, true)