title: Dynamic hierarchy in Database: RDBMS vs Graph based db (Neo4j)
body: <p>I had a requirement to implement dynamic hierarchy in a project. One possible solution was to use a Graph database NoSQL solution like Neo4j. What I designed in a graph implementation in RDBMS.
  In this solution I designed a table has a Many To Many relationship with itself.
  An example of this is given <a href="https://stackoverflow.com/questions/1656113/hibernate-many-to-many-association-with-the-same-entity"><b>here</b></a>.
  I have a table (<strong>TABLE_A</strong>) that defines different entities and another table <strong>TABLE_B</strong> that defines type of the entities, and TABLE_B has a many to many relation with it self that defines relation between different entity types. This is store in a <strong>JoinTable, TABLE_C</strong>. Similarly TABLE_A has a many to many relationship with itself to define instances of different relations defined in TABLE_C.
  In Java I have used only two classes to implement this structure.</p>
  
  <p>Now this many to many relationship in my case is not a always a many to many relationship.
  Sometimes it's a one to many and at time a one to one.</p>
  
  <p>Firstly, is a No SQL Graph DB more suited to my requirement than a Relational DB since the data that I'm planning to test will be in the order of Hundred Thousand records.</p>
  
  <p>Secondly, If RDBMS solution is better then is there a way to include a property in the join table <strong>TABLE_C</strong> that defines the <strong>multiplicity</strong> of the relation i.e. whether it's a one to many or a many to many or a one to one relation?</p>