Ejemplo n.º 1
0
 @Override
 public void onStart(Application app) {
   // Check if the database is empty
   if (User.finder.findRowCount() == 0) {
     Map<String, List<Object>> all = (Map<String, List<Object>>) Yaml.load("initial-data.yml");
     Ebean.save(all.get("users"));
     Ebean.save(all.get("projects"));
     Ebean.save(all.get("tasks"));
   }
 }
Ejemplo n.º 2
0
    public static void insert(Application app) {
      if (Ebean.find(User.class).findRowCount() == 0) {

        Map<String, List<Object>> all = (Map<String, List<Object>>) Yaml.load("initial-data.yml");

        // Insert users first
        Ebean.save(all.get("users"));

        // Insert tapps
        Ebean.save(all.get("apps"));

        //                // Insert projects
        //                Ebean.save(all.get("projects"));
        //                for(Object project: all.get("projects")) {
        //                    // Insert the project/user relation
        //                    Ebean.saveManyToManyAssociations(project, "members");
        //                }
        //
        //

      }
    }