在应用程序中,我们有许多站点和节点。实体是:
public class Site {
@OneToMany(mappedBy = "site")
@Cache(region = "visionaelCache", usage = CacheConcurrencyStrategy.READ_WRITE)
@BatchSize(size = 25)
private Set<Node> nodes = new HashSet<Node>();
}
public class Node {
@QueryableRelationship(direction = QueryableRelationship.Direction.PARENT)
@ManyToOne(optional = true, fetch = FetchType.LAZY)
@Fetch(FetchMode.SELECT)
@JoinColumn(name = "site_id")
private Site site;
...
public void addToNodes(Node node) {
node.setSite(this);
this.nodes.add(node);
}
}
当我们使用mySite.addToNodes(myNode)
向网站添加节点时,完成操作需要花费太多时间。有关加快这项行动的建议吗?