Java Application out-of-the-box object persistence

Source: Internet
Author: User
Tags command line log4j

Simple persistence for Java is an open source object-relational persistence library that simplifies object persistence in Java applications using a custom query language and built-in database support. In this article, Software Architect Sami Salkosuo introduces the library and takes you through 0 management of object persistence and 0 configuration methods.

Object persistence is almost a prerequisite for all Java™ applications, from desktop applications to enterprise-class applications. The downside of persistence is that it's not always easy. However, this situation has changed in the most recent version of simple persistence for Java, an Open-source object-relational Persistence library.

The simple persistence for Java 2.1.0 version adds support for HSQLDB, Hsqldb is a pure Java database. Simple persistence for Java and hsqldb do not require application user management and configuration. With these considerations in mind, these tools allow you to introduce persistence into your application with a considerable amount of effort.

This article introduces you to the simple persistence for Java v2.1.0 and shows you how to use the library almost effortlessly to get object persistence in Java applications.

Simple persistence for Java

Simple persistence for Java is an open source library under the LGPL license, developed and published in-house by Hungarian company Netmind Consulting.

Java developers have a number of object-relational libraries available. Simple persistence for Java differs from other libraries in that it can be used with zero configuration. One of the main design principles for this library is that you do not need to configure configuration files, XML mapping files, and attributes (of course, you need to have a suitable database).

The simple persistence for Java library also has some of the following important features:

Small storage space (135KB)

A simple API

Support for multiple databases

Simple Query Language

Polymorphism

Lazy Results List

In version 2.1.0, the simple persistence for Java library added support for the HSQLDB database. Hsqldb is an open-source, lightweight, Pure Java SQL database engine that is licensed by a BSD-style license agreement. HSQLDB supports a rich subset of ANSI-92 SQL and also supports SQL 99 and 2003 enhancements. It provides memory-and disk-based tables, and supports inline and server-mode operations.

StockData applications

I'll show you how easy it is to get object persistence by simply persistence for Java libraries and HSQLDB with a sample program called StockData. StockData Filters Historical securities data (in a CSV file) based on user queries. The program operates in conjunction with an inline database and runs from the command line.

To continue this discussion, you need to rebuild a development environment like mine and build a sample application. The StockData development environment is the Eclipse 3.2.1, and the lowest Java version is the JDK 1.5.0. I used the memory based database option to open the HSQLDB database in embedded mode. Note that I can choose a disk-based embedded database or server-side database, but for demonstration purposes I chose the HSQLDB based database.

The following libraries are required to perform the StockData sample program:

Commons-io-1.2.jar

Commons-logging-api.jar

Commons-logging.jar

Hsqldb.jar

Java-cup-11-runtime.jar

Log4j-1.2.8.jar

Netmind-persistence-2.1.0.jar

The StockData program uses Commons-io packages and commons-logging packages, and HQSLSB does not rely on any jar files. Netmind-persistence-2.1.0.jar relies on Java-cup-11-runtime.jar and Log4j-1.2.8.jar.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.