{"id":20756840,"url":"https://github.com/jesusbmx/ormx-android","last_synced_at":"2026-05-05T15:40:00.261Z","repository":{"id":155769405,"uuid":"238724632","full_name":"jesusbmx/ormx-android","owner":"jesusbmx","description":"Convertir datos entre el sistema de tipos utilizado en un lenguaje de programación orientado a objetos","archived":false,"fork":false,"pushed_at":"2024-07-22T15:05:15.000Z","size":647,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-07T17:59:24.092Z","etag":null,"topics":["android","orm","pojo","sqlite","sqlite-android"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jesusbmx.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-02-06T15:48:41.000Z","updated_at":"2024-07-22T15:05:18.000Z","dependencies_parsed_at":null,"dependency_job_id":"1dd3c9e2-7459-47cb-9d2f-a2a68888df62","html_url":"https://github.com/jesusbmx/ormx-android","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jesusbmx%2Formx-android","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jesusbmx%2Formx-android/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jesusbmx%2Formx-android/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jesusbmx%2Formx-android/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jesusbmx","download_url":"https://codeload.github.com/jesusbmx/ormx-android/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243065577,"owners_count":20230783,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["android","orm","pojo","sqlite","sqlite-android"],"created_at":"2024-11-17T09:35:34.367Z","updated_at":"2026-05-05T15:39:55.240Z","avatar_url":"https://github.com/jesusbmx.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"## ORMX\n\nConvertir datos entre el sistema de tipos utilizado en un lenguaje de programación orientado a objetos\n\n## Ejemplos\n\nSimple CRUD\n\n```java\n@TableInfo(name = \"tb_nota\")\npublic class Nota {\n\n  // Variables\n\n  @ColumnInfo(primaryKey = true, autoIncrement = true)\n  public long id;\n\n  @ColumnInfo\n  public long fecha;\n\n  @ColumnInfo\n  public String texto;\n\n  // Constructor\n\n  public Nota() {\n    // TODO Auto-generated constructor stub\n  }\n\n  // Funciones \n\n  /**\n   * @return una lista del recurso.\n   */\n  public static List\u003cNota\u003e getAll() {\n    DB db = DB.db;\n    try {\n      return db.queryBuilder()\n        .order_by(\"fecha\", \"desc\")\n        .get_list(Nota.class);\n    } finally {\n      db.close();\n    }\n  }\n\n  /**\n   * Guarda el registro.\n   * \n   * @param o modelo\n   * \n   * @return boolean \u003cb\u003eTRUE\u003c/b\u003e exito \u003cb\u003eFALSE\u003c/b\u003e fallo\n   */\n  public static boolean save(Nota o) {\n    return (o.id == 0) ? insert(o) : update(o);\n  }\n\n  /**\n   * Inserta un registro en la db.\n   * \n   * @param o modelo\n   * \n   * @return boolean \u003cb\u003eTRUE\u003c/b\u003e exito \u003cb\u003eFALSE\u003c/b\u003e fallo\n   */\n  public static boolean insert(Nota o) {\n    DB db = DB.db;\n    try {\n      return db.dao(Nota.class)\n        .insert(o);\n    } finally {\n      db.close();\n    }\n  }\n\n  /**\n   * Actualiza un registro en la db.\n   * \n   * @param o modelo\n   * \n   * @return boolean \u003cb\u003eTRUE\u003c/b\u003e exito \u003cb\u003eFALSE\u003c/b\u003e fallo\n   */\n  public static boolean update(Nota o) {\n    DB db = DB.db;\n    try {\n      return db.dao(Nota.class)\n        .update(o) \u003e 0;\n    } finally {\n      db.close();\n    }\n  }\n\n  /**\n   * Elimina un registro.\n   * \n   * @param id identificador\n   *\n   * @return boolean \u003cb\u003eTRUE\u003c/b\u003e exito \u003cb\u003eFALSE\u003c/b\u003e fallo\n   */\n  public static boolean delete(long id) {\n    DB db = DB.db;\n    try {\n      return db.dao(Nota.class)\n        .deleteById(id) \u003e 0;\n    } finally {\n      db.close();\n    }\n  }\n\n  public static OrmIterator\u003cNota\u003e query(String q, Date date) throws SQLException {\n    DB db = DB.db;\n    QueryBuilder query = db.dao(Nota.class).queryBuilder()\n      //.select(\"*\")\n      //.distinct()\n      //.from(\"tb_nota\")\n      .where(\"CAST(fecha AS DATE)\", \"=\", date.getTime())\n      .like(\"texto\", q)\n      //.where_in(\"id\", 50, 60, 30)\n      //.or_where_in(\"id\", 22, 44)\n      //.where(\"id\", \"\u003e\", 14)\n      //.where_not_in(\"id\", 50, 60, 30)\n      //.or_where_not_in(\"id\", 22, 44)\n      //.not_like(\"texto\", \"jet\")\n      //.join(\"tb_nota b\", \"tb_nota.id = b.id\")\n      //.join(\"tb_nota c\", \"tb_nota.id = c.id\", \"LEFT\")\n      .order_by(\"fecha\", \"DESC\").order_by(\"id\", \"DESC\")\n      //.group_by(\"tb_nota.id\")\n      //.group_by(\"tb_nota.texto\")\n      //.having(\"tb_nota = 'Hello world'\")\n      //.limit(7, 25)\n    ;\n    \n    return query.get_it(Nota.class); // Iterator\u003cNota\u003e\n    // return query.get_list(Nota.class); // List\u003cNota\u003e\n    // return query.get(Nota.class); // OrmResult\n    // return query.get_first(Nota.class); // Nota\n    // return query.get_select_count(\"*\"); // long\n  }\n}\n\n```\n\n### Config database\n\n```java\npublic class DB extends OrmDataBase {\n\n  // Constantes\n\n  public static final String NAME = \"notas.db\";\n  public static final int VERSION = 1;\n\n  public static DB db = null;\n\n  // Constructor\n\n  private DB(Context context) {\n    super(context, NAME, null, VERSION);\n  }\n\n  // Funciones\n\n  @Override\n  public void onCreate(SQLiteDatabase db) {\n    db.execSQL(\"CREATE TABLE tb_nota (\"\n      + \"id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, \"\n      + \"fecha INTEGER, \"\n      + \"texto TEXT)\");\n  }\n\n  @Override\n  public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {\n    if (oldVersion \u003c newVersion) {\n      db.execSQL(\"DROP TABLE IF EXISTS tb_nota\");\n      this.onCreate(db);\n    }\n  }\n\n  public static void init(Context applicationContext) {\n    db = new DB(applicationContext);\n    db.getWritableDatabase();\n  }\n}\n```\n\n```java\nDB.init(getApplicationContext());\n```\n\nLicense\n=======\n\n    Copyright 2020 JesusBetaX, Inc.\n\n    Licensed under the Apache License, Version 2.0 (the \"License\");\n    you may not use this file except in compliance with the License.\n    You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n    Unless required by applicable law or agreed to in writing, software\n    distributed under the License is distributed on an \"AS IS\" BASIS,\n    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n    See the License for the specific language governing permissions and\n    limitations under the License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjesusbmx%2Formx-android","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjesusbmx%2Formx-android","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjesusbmx%2Formx-android/lists"}