{"id":21678338,"url":"https://github.com/ifyun/simpleorm","last_synced_at":"2025-03-20T09:46:58.510Z","repository":{"id":41019261,"uuid":"248963435","full_name":"ifyun/SimpleORM","owner":"ifyun","description":"A super simple ORM.","archived":false,"fork":false,"pushed_at":"2022-06-29T00:54:07.000Z","size":8,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-25T10:28:13.047Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ifyun.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-03-21T11:37:21.000Z","updated_at":"2022-06-29T00:54:00.000Z","dependencies_parsed_at":"2022-09-05T12:40:21.950Z","dependency_job_id":null,"html_url":"https://github.com/ifyun/SimpleORM","commit_stats":null,"previous_names":["ifyun/simpleorm"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ifyun%2FSimpleORM","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ifyun%2FSimpleORM/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ifyun%2FSimpleORM/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ifyun%2FSimpleORM/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ifyun","download_url":"https://codeload.github.com/ifyun/SimpleORM/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244591480,"owners_count":20477707,"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":[],"created_at":"2024-11-25T14:28:12.648Z","updated_at":"2025-03-20T09:46:58.469Z","avatar_url":"https://github.com/ifyun.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Simple ORM\n\nThis is a super simple ORM using Java Reflect and Dynamic Proxy.\n\n### Use\n\n#### Crete Factory\n\nSet a `DataSource`  for `DaoFactory` .\n\n```java\n// Create a DataSource (DBCP, HikariCP and so on).\nDataSource dataSource = ...;\nDaoFactory factory = new DaoFactory(dataSource);\n```\n\n#### Create Dao Interface\n\nUse `@Select` , `@Insert` ,`@Update` and `@Delete` to write DML statements.\n\n```java\npublic interface ItemDao {\n\n    @Select(sql = \"select * from item\")\n    List\u003cHashMap\u003cString, Object\u003e\u003e getAll();\n\n    @Select(sql = \"select * from item where id = ?\")\n    HashMap\u003cString, Object\u003e getById(long id);\n\n    @Insert(sql = \"insert into item(name) values(?)\", useGeneratedKey = true)\n    long add(String name);\n\n    @Delete(sql = \"delete from item where id = ?\")\n    long removeById(long id);\n}\n```\n\n\u003e The `@Select` annotation only support `HashMap` as return type currently.  \n\u003e set `useGeneratedKey` to `true` could return auto-generated primary key.\n\n#### Create Proxy Object\n\nUse proxy object to manipulate data.\n\n```java\nItemDao itemDao = (ItemDao) factory.create(ItemDao.class);\n// Select all\nList\u003cHashMap\u003cString, Object\u003e\u003e items = itemDao.getAll();\n// Select by id\nHashMap\u003cString, Object\u003e item = itemDao.getById(id);\n// Insert\nlong id = itemDao.add(\"NewItem\");\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fifyun%2Fsimpleorm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fifyun%2Fsimpleorm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fifyun%2Fsimpleorm/lists"}