I use a db2 database on an iSeries (AS400) to store my project.  I connect
just fine, and I can create nodes, child nodes and grandchild nodes, along
with appropriate properties.  It's just that it is so very slow.  20-30
seconds per node!  Am I doing anything wrong?

The controlling methods are:

        public Node createNode(Session session, Node node, String name, String
text, String type) {
                SetupNode sn = new SetupNode();         
                Node node1 = null;
                
                try {
                        // Create node
                        if (!node.hasNode(name)) {
                                node1 = sn.setupNode(session, node, name, true);
                        } else {
                                node1 = node.getNode(name);
                        }
                        
                        // Set properties
                        node1.setProperty("text", text);
                        node1.setProperty("type", type);
                        session.save();

                } catch (Exception e) {
                        e.printStackTrace();
                }
                return node1;
        }

                // NOTE...THIS METHOD IS IN A COMMON CLASS... SetupNode()
                public Node setupNode(Session session, Node parent, String
child, boolean version) {

                // Node Attributes
                final String VERSIONABLE = "mix:versionable";
                final String REFERENCEABLE = "mix:referenceable";
                Node childNode = null;

                try {
                        // Don't checkout root node
                        if (!parent.isNodeType("rep:root")) {
                                parent.checkout();
                        }

                        // Add node, if needed
                        if (!parent.hasNode(child)) {
                                childNode = parent.addNode(child);
                        } else {
                                childNode = parent.getNode(child);      
                        }
                        // Set node attributes
                        
                        if (!childNode.isNodeType(REFERENCEABLE)) {
                                childNode.addMixin(REFERENCEABLE);
                        }
                        // Is node versioned?
                        if (version) {
                                if (!childNode.isNodeType(VERSIONABLE)) {
                                        childNode.addMixin(VERSIONABLE);
                                }
                        }
                        // Save/Checkin child node
                        session.save();
                        childNode.checkin();

                        // Checkin parent node
                        if (!parent.isNodeType("rep:root")) {
                                parent.checkin();
                        }

                } catch (Exception e) {
                        e.printStackTrace();
                }

                return childNode;
        }
        


-- 
View this message in context: 
http://www.nabble.com/Creating-Nodes-is-Excruciatingly-Slow-tf3556976.html#a9932243
Sent from the Jackrabbit - Dev mailing list archive at Nabble.com.

Reply via email to