My favorites | Sign in
Project Home Downloads Wiki Issues Source
Project Information
Members
Featured
Downloads
Wiki pages

An xml persistence layer written using XStream to persist java objects in a very simple fashion. All that is currently required is that the object has an ID field identified with an @Id annotation, and it can be persisted and loaded separately from associated objects.

  • Written in Java.
  • Tested using groovy.
  • @Id (see IdAnnotation) for Number based identifiers
  • Lazyload fields from store with @LazyLoad (collections not yet implemented)
  • Small, fast and easy

Example (see tests for more):

import org.corbym.simplex.persistence.annotations.Id
...
class SomeObjectWithId(){
    @Id
    def id
}
...
class SomeObjectWithDefFieldAndId{
    @Id
    def id
    def somefield
}
...
final idObject = new SomeObjectWithId()
final someObject = new SomeObjectWithDefFieldAndId(somefield: ["thingy": idObject])
someObject.somefield.put "thing2", new SomeObjectWithoutId()
dao.save(someObject)

assert someObject.id != null
assert idObject.id != null

def loaded = dao.load(SomeObjectWithId, idObject.id)
assert loaded, "object should be loaded but was $loaded"

def otherThatContainedIdObject = dao.load(SomeObjectWithDefFieldAndId, someObject.id)
assert otherThatContainedIdObject.somefield.values().size() == 2

Dependencies:

xstream-1.3.1

Powered by Google Project Hosting