This is a simple ORM implementation to demonstrate the usage of the reflection API. Well known ORM frameworks like Hibernate or EclipseLink are built based on the same principles. To demonstrate the reflection API on methods, a simple dependency injection is also implemented with the same principles as used by Spring, CDI or Guice. ORM and DI, are the two main applications of the reflection API.
- Create DB file:
src/db-files/db-orm.mv.db
- Update URL in the EntityManager (without .mv.db):
jdbc:h2:<path-to>/src/db-files/db-orm
- Start the DBLauncher.
- Use same URL as the EntityManager to connect with browser to DB:
jdbc:h2:<path-to>/src/db-files/db-orm
- Create table:
create table Person (
k_id int primary key,
c_name varchar(40),
c_age int
)
Once the H2 database is setup, disconnect the browser client to be able to run:
- WritingObjects
- ReadingObjects
Verify the the information in the standard output.