Reputation: 11
JTree created by me populates from databases. I want to add new node which I am able to create insertNodeInto() function. Now how do I change the underlying database?
I would like to know the steps involved in case (1) above as the tree I created has large number of nodes.
Upvotes: 1
Views: 161
Reputation: 17784
I would add it first to the database. The reason is that if the DB insert fails for some reason (constraints for example) and you get an SQLException, the user should not get the impression that the insert was successful.
Of course, you don't need to recreate the tree, you can just add another node at any time.
Upvotes: 3