What is JOR?

JOR is a lightweight Java Object Relation mapping tool that is very simple to use. It works with all mayor databases and requires only minimal coding effort. JOR strictly follows the POJO / POJI (Plain Old Java Objects / Plain Old Java Interfaces) model.

How to use it

Let's say you have a table in the database defined in the following way: CREATE TABLE TEST(Id INT AUTOINCREMENT PRIMARY KEY, Name VARCHAR(255)). Then you have a Java class: public class Test { int id; String name; }; Now, in your application, you can use use JOR in the following way:

Database db = Database.connect("jdbc:hsqldb:test", "sa", "");
db.map(Test.class);
Test o = new Test();
o.name = "Hello";
db.save(o);
Test o2 = (Test)db.load(Test.class, 1);
db.close();

It is also possible to use private member fields and getters/setters. Also different column/table names in the database and in the Java code may be used, but then the mapping between Java and SQL must be specified explicitly (see documentation).

How does it work?

JOR uses Java reflection and SQL metadata to build the mapping between the Java code and the SQL database. To achieve database independency, LDBC (http://ldbc.sf.net) is used as the database abstraction layer.

License

LGPL is used for the software. All software available here can be used in commercial applications at no cost. The application does not need to be LGPL or GPL to be able to use the software.

THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE DEVELOPMENT GROUP, OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

SourceForge Logo