Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[eclipselink-users] Where to maintain Transitive Closure of a DAG?

Hi!

I have a directed acyclic graph, represented with entities like this:

class Vertex {
  int id;
}

class Edge {
  int inVertexId;
  int outVertexId;
}

In order to quickly find out whether a vertex is reachable from
another vertex, I need to maintain a transitive closure (an "is
reachable" relation):

class TransitiveEdge {
  int inVertexId;
  int outVertexId;
}

I of course do not want to burden the user (of the Edge class) with
this. Whenever an edge is added or removed, I need to update the the
transitive closure.

JPA apparently does not allow the use of EntityManager in
@PostPersist/@PostRemove.

Is there any other way of achieving this automatically?

Regards,
Jaka


Back to the top