1

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

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

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

我环顾四周,找到了,BatchInserter但它不关心索引。我找到了这个示例实现,但如果没有其他选择,我会尝试它。

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

我正在使用 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
}

这是扩展抽象 Building 类并保留在 DB 中的 NewBuilding 类。

@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
}
4

1 回答 1

0
  • 您能否分享您的实体或表现出相同行为的示例项目?
  • 您的数据库中已有多少数据?
  • 您使用简单映射还是高级映射?
  • 您是否有跨越该方法的外部事务save
  • 我认为您的时间花在处理关系上(SDN 对每个关系进行重复检查)您可以尝试替换那些template.createRelationshipBetween(entity1, entity2, type, properties, true)跳过这些检查的关系吗?
于 2012-12-16T21:01:24.227 回答