Comments
litl_phil wrote: While it's nice that Google and Acer share the vision of cloud-based computing, it's also worth noting that we at litl already have a webbook on the market (available at litl.com) that runs our own cloud-based OS. Unlike Chrome, litlOS is focused on creating a new and better web experience for the home, so we don't have the usual browser interface, we have our own innovative UI. In conjunction with easel mode (litl's inverted-V position) and our growing cohort of litl channels (special apps t...
Cloud Expo on Google News


2008 West
DIAMOND SPONSOR:
Data Direct
SOA, WOA and Cloud Computing: The New Frontier for Data Services
PLATINUM SPONSORS:
Red Hat
The Opening of Virtualization
GOLD SPONSORS:
Appsense
User Environment Management – The Third Layer of the Desktop
Cordys
Cloud Computing for Business Agility
EMC
CMIS: A Multi-Vendor Proposal for a Service-Based Content Management Interoperability Standard
Freedom OSS
Practical SOA” Max Yankelevich
Intel
Architecting an Enterprise Service Router (ESR) – A Cost-Effective Way to Scale SOA Across the Enterprise
Sensedia
Return on Assests: Bringing Visibility to your SOA Strategy
Symantec
Managing Hybrid Endpoint Environments
VMWare
Game-Changing Technology for Enterprise Clouds and Applications
Click For 2008 West
Event Webcasts

2008 West
PLATINUM SPONSORS:
Appcelerator
Get ‘Rich’ Quick: Rapid Prototyping for RIA with ZERO Server Code
Keynote Systems
Designing for and Managing Performance in the New Frontier of Rich Internet Applications
GOLD SPONSORS:
ICEsoft
How Can AJAX Improve Homeland Security?
Isomorphic
Beyond Widgets: What a RIA Platform Should Offer
Oracle
REAs: Rich Enterprise Applications
Click For 2008 Event Webcasts
SYS-CON.TV
Top Links You Must Click On


Evaluating Options for Persisting Java Objects
Hibernate, DB4O, and Caché Database with Jalapeño

Support for Indices
Can you define indices that will enhance the performance of your queries?

Hibernate
Use the annotation @Index to cause an index to be created for the specified column or columns.

DB4O
You can define indexes in your DB4O configuration method before you open the object container. For example:

Db4o.configure().objectClass(Foo.class).objectField("bar").indexed(true);

Caché
Caché provides powerful indexing options. Besides specifying that the property must be unique, you can specify the following index types:

type = "" (default standard index), bitmap, bitslice, index, and key. For example:

    @Indices({
       @Index(name="IndexOnName", columnNames={"Name"}),
       @Index(name="IndexOnSSN", type="bitmap", columnNames={"SSN"})
    })

BitMap indices provide extremely high performance filtering for columns that have a limited number of possible values (such as categories) or which have a fixed number of characters (such as Social Security Numbers).

Enforcement of Property Constraints
Can you limit or control the values that will be saved to the database?

Hibernate
With Hibernate, you are limited to specifying that a property be NOT NULL or UNIQUE, although you may be able to specify constraints in the underlying database.

DB4O
DB4O doesn't provide any support for constraints.

Caché
Caché provides @PropertyParameter and @PropertyParameters annotations so you can control the values entered into a property. You can specify a maximum value, minimum value, and even an input pattern.

   @PropertyParameter (name = "PATTERN", value = "3N1\"-\"2N1\"-\"4N")
   public String ssn;

   @PropertyParameter (name = "MINVAL", value = "0")
   public float balance;

Security and Access Control
How do you control who has access to the data and what they can do with it?

Hibernate
This can be performed programmatically or via the underlying database.

DB4O
You can encrypt and password-protect the database file, but there are no other user access controls. Once you have access to the database, you have access to all the data in it. If you want to control access to specific data or objects in the database, this can only be done programmatically.

Caché
This can be done programmatically or via the Caché System Management Portal. You can specify which objects the user has access to as well as the level of access (ALTER, SELECT, INSERT, UPDATE, DELETE, and REFERENCES)

Portability
How portable is the solution? Is there a vendor tie-in?

Hibernate
By definition and purpose, Hibernate helps make your application database-independent - so long as you stick to standard SQL and don't use database-specific functionality. This can be useful if you want to prototype your application on a lightweight database and move it to a more robust database later at production, however I feel that it's typically better to match your development environment to the production environment as much as possible. I've also seen very few instances where an application has been migrated to another database except in extreme legacy systems.

DB4O
With DB4O, you could say there's a vendor tie-in, but you can always add Hibernate annotations to your POJOs and run a script to read in your data from DB4O and save it to your Hibernate persistence layer.

Caché/Jalapeño
Caché stores objects using sparse arrays, so it's not your typical relational database. However, you can access data as objects or via Caché's SQL projection - which makes it look and act like a relational database (to your JDBC applications at any rate). Interestingly enough, you can also use Jalapeño to export your Caché class schema to a DDL file that can be imported into a relational database. You can then use Hibernate to map your objects to the new relational schema - or continue to use the Jalapeño Object Manager to interact with the new data source. The Object Manager automatically uses object persistence methods (Open, Save, New, Delete) when accessing Caché, and relational persistence methods (Select, Update, Insert, Delete) when it's configured to connect to a relational database.

Conclusion
While you can eliminate mapping your objects to relational tables altogether, using DB4O or Caché, for example, it appears that some work must always be done if you want to take advantage of advanced database/datastore features such as enforcing referential integrity and uniqueness.

Hibernate has come a long way since it was first released. It has a bewildering number of options for configuring your object persistence mappings and behavior - as well as great tools to make it if not painless then at least not so painful.

If you want to quickly persist your objects for a small project and you can manage uniqueness and referential integrity within your application code - look no further than DB4O. It just doesn't get any easier.

The Caché/Jalapeño combination provides a compelling option for quickly persisting your Java objects with a minimum of effort while providing excellent control over database-specific functionality.

While you were busy programming your last tour de force, your peers and technology vendors have been busy building tools that enable you to do things that were previously impossible. You owe it to yourself and to your clients to pause once in a while and survey the state-of-the-art in databases and development tools to see where new entries can save you time and effort. For a comparison of features, go to the online version of this article at http://jdj.sys-con.com.

Resources
• Comparative Study of Persistence Mechanisms for the Java Platform.
http://research.sun.com/techrep/2004/abstract-136.html
• Mark Weisfeld. The Object-Oriented Thought Process. SAMS Publishing. This is an excellent analysis of what object-oriented design is all about and how it compares to procedural programming.

Java Serialization:
• Discover the secrets of the Java Serialization API.
http://java.sun.com/developer/technicalArticles/Programming/serialization/
• Bruce Eckell. Thinking in Java. www.mindview.net/Books/TIJ/

Hibernate:
• Web site: www.hibernate.org/
• Dave Minter and Jeff Linwood. Beginning Hibernate. Apress. 2006.

InterSystems' Caché Database:
• Web site: www.intersystems.com/Cache
• Jalapeño: www.intersystems.com/Jalapeno

DB4O:
• Web site: www.db4o.com/
• Simple Object Persistence with the db4o Object Database.
www.onjava.com/pub/a/onjava/2004/12/01/db4o.html

About Richard Conway
Richard Conway is a software developer and technology consultant with more than 15 years of technology, project management, and information services experience. He has extensive experience developing Java/Struts-based web applications. He started focusing more on Swing based developments at the beginning of 2005 and has just finished a Swing-based client/server asset management project. He lives in Miami with his wife Patricia, is currently working on an EMR application, and plays sand volleyball in his spare time.

In order to post a comment you need to be registered and logged in.

Register | Sign-in

Reader Feedback: Page 1 of 1

Hi,
your article is very well done. However one point:
>DB4O doesn't provide any support for constraints.
The is only partially true.
It's more then easy to implement this in just a few simple lines using db4o callbacks.

Best
Stefan Edlich
(Author of "The Defintive Guide to db4o" Apress)

Hi,
your article is very well done. However one point:
>DB4O doesn't provide any support for constraints.
The is only partially true.
It's more then easy to implement this in just a few simple lines using db4o callbacks.

Best
Stefan Edlich
(Author of "The Defintive Guide to db4o" Apress)


Your Feedback
Stefan Edlich wrote: Hi, your article is very well done. However one point: >DB4O doesn't provide any support for constraints. The is only partially true. It's more then easy to implement this in just a few simple lines using db4o callbacks. Best Stefan Edlich (Author of "The Defintive Guide to db4o" Apress)
Stefan Edlich wrote: Hi, your article is very well done. However one point: >DB4O doesn't provide any support for constraints. The is only partially true. It's more then easy to implement this in just a few simple lines using db4o callbacks. Best Stefan Edlich (Author of "The Defintive Guide to db4o" Apress)
Enterprise Open Source Magazine Latest Stories . . .
Oracle seems to have divided the open source ranks over the MySQL delay it’s having closing its acquisition of Sun. Eben Moglin, the GPL’s most ardent defender and delineator, the lawyer who has worked hand in glove for years with the Free Software Foundation’s founder Richard Stallman...
Cloud computing is a game changer. The cloud is disrupting traditional software and hardware business models by disrupting how IT service gets delivered. Entrepreneurial opportunities abound as this classic disruptive technology begins to proliferate, so it is no surprise that SYS-CON'...
The irony is that Oracle has advanced MySQL, lost money in the process, and helped its competitors - all at the same time. When Oracle buys Sun and controls MySQL the gift (other than to Microsoft SQL Server) keeps on giving as the existential threat to RDBs is managed by Redwood Shore...
WSO2, the open source SOA company, today announced the launch of the WSO2 Cloud Platform. Available today, the new WSO2 Cloud Platform features a family of WSO2 Cloud Virtual Machines; WSO2 Cloud Connectors for enabling fast, secure cloud services; and the multi-tenant WSO2 Governance-...
Now, the open source Mozilla Thunderbird client software can be used with Open-Xchange collaboration software. The "Community OXtender for Thunderbird" software connector gives users full access to appointments and contacts stored in the Open-Xchange Server and enables them to use Thun...
Morph Labs, a leading provider of enterprise cloud computing technology, today announced an introductory trial of the Morph CloudServer, an open, standards-based server IT organizations can use to rapidly model and evaluate their cloud implementations. A miniature "Cloud Environment in...
Subscribe to the World's Most Powerful Newsletters
Subscribe to Our Rss Feeds & Get Your SYS-CON News Live!
Click to Add our RSS Feeds to the Service of Your Choice:
Google Reader or Homepage Add to My Yahoo! Subscribe with Bloglines Subscribe in NewsGator Online
myFeedster Add to My AOL Subscribe in Rojo Add 'Hugg' to Newsburst from CNET News.com Kinja Digest View Additional SYS-CON Feeds
Publish Your Article! Please send it to editorial(at)sys-con.com!

Advertise on this site! Contact advertising(at)sys-con.com! 201 802-3021


SYS-CON Featured Whitepapers
ADS BY GOOGLE