コード例 #1
0
 public static void createSomeInstitutions(int numInstitutions) {
   for (int i = 0; i < numInstitutions; i++) {
     User.NameGenerator ng = new User.NameGenerator();
     Institution in =
         new Institution("School of " + ng.getName(), ng.getName() + ", VA", "descriptionnnn");
     in.save();
   }
 }
コード例 #2
0
  public static void delete(Long id) {
    Institution institution = find.ref(id);
    if (institution == null) {
      return;
    }

    institution.retired = true;
    institution.save();
  }
コード例 #3
0
  public static List<Institution> getAllInstitutionsForStudent(Long studentId) {
    String sql =
        "select * from institution "
            + "where id in "
            + "(select institution_id from student_in_institution "
            + "where student_id="
            + studentId
            + ")";

    List<Institution> allInstitutions = new ArrayList<Institution>();

    List<SqlRow> rows = Ebean.createSqlQuery(sql).findList();
    for (SqlRow row : rows) {
      allInstitutions.add(Institution.byId(row.getLong("id")));
    }

    return allInstitutions;
  }
コード例 #4
0
 /** ****************************** CREATE / DELETE ****************************** */
 public static Institution create(Institution institution) {
   institution.save();
   return institution;
 }