As far as I can tell, it's not an infinite loop. Granted, this is more of a scalability issue than a bug. However, seeing an industry standard tool such as Hibernate choke on a single-linked list with merely 3000 entries was pretty disappointing, so I thought that I should let you know that this is an issue. In my use case, I have to deal with arbitrary graphs with 30k to 100k nodes and arbitrary connections in between, cycles included. Increasing the JVM stack size just won't cut it.
The only possible solution that I can see right now is to perform a change in the meta model. Instead of maintaining a Set<Node> for the neighbors of a node, I would have to maintan a Set<String> that contains the node IDs of the neighbors, and resolve the neighbors in the business logic by loading them by id from the database. It's not very pretty, and it's definitly not a very ORM-style solution, but it scales to the required dimensions.
|