Search code examples
javaderby

Apache Derby simplified usage


I'm using apache derby in a project and no problems so far. But writing all the sql statements, defining the names of the columns and so on is very time consuming. I tried to abstract the sql statements in a way but I'm sure I'm not the first one who tried to simplified the usage with derby.

Does anyboby know, is there a framework or something similar which one can use on top of derby? Or should I try an approach with reflections, in which for example the fields of a class were automatically used as columns of a table? And also if one defines methods in that class in a predefined manner, the code for the sql statements is automatically generated. I never used reflections so I'm not sure if I have a wrong idea what one could achieve with reflections.

Thanks in advance for any helpful hint concering this.


Solution

  • I think what you're looking for is an ORM, an Object-Relational Mapper.

    This allows convenient transformation between data in a variety of databases and the object models actually used by your code.

    Hibernate is an implementation of JPA (Java Persistence API) that is widely used, but there are others.