package net.sourceforge.javydreamercsw.client.ui.nodes;

import com.validation.manager.core.DataBaseManager;
import com.validation.manager.core.db.Project;
import java.util.Iterator;
import java.util.List;
import net.sourceforge.javydreamercsw.client.ui.components.database.DataBaseTool;

/**
 *
 * @author Javier A. Ortiz Bultron <javier.ortiz.78@gmail.com>
 */
public class ProjectChildFactory extends AbstractChildFactory {
    
    @Override
    protected boolean createKeys(List<Object> list) {
        if (DataBaseTool.getEmf() != null) {
            List<Object> projects = DataBaseManager.createdQuery(
                    "select p from Project p where p.parentProjectId is null");
            for (Iterator<Object> it = projects.iterator(); it.hasNext();) {
                list.add((Project) it.next());
            }
        }
        return true;
    }

    @Override
    protected void updateBean() {
        //Nothing to do, createKeys already does.
    }
}

@@ -164,25 +164,69 @@
 ort 
-java.util.Iterato
+com.validation.manager.core.db.controller.ProjectJpaControlle
 r;%0D%0A
@@ -481,14 +481,10 @@
  %7B%0D%0A
-    
 %0D%0A
+
     
@@ -608,26 +608,27 @@
        List%3C
-Ob
+Pro
 ject%3E projec
@@ -636,198 +636,201 @@
 s = 
-DataBaseManager.createdQuery(%0D%0A                    %22select p from Project p where p.parentProjectId is null%22);%0D%0A            for (Iterator%3CObject%3E it = projects.iterator(); it.hasNext();
+new ProjectJpaController(DataBaseManager.getEntityManagerFactory()).findProjectEntities();%0D%0A            for (Project p : projects) %7B%0D%0A                if (p.getParentProjectId() == null
 ) %7B%0D%0A
+    
     
@@ -854,29 +854,30 @@
 add(
-(Project) it.next());
+p);%0D%0A                %7D
 %0D%0A  

Fix runtime error.