com.ikokoon.serenity.persistence
Class DataBaseJpa

java.lang.Object
  extended by com.ikokoon.serenity.persistence.DataBase
      extended by com.ikokoon.serenity.persistence.DataBaseJpa
All Implemented Interfaces:
IDataBase

public class DataBaseJpa
extends DataBase

This is the JPA database implementation. This class could be used in the future if so desired by a user of the Serenity plugin. The issue with the JPA database is the speed of persistence and where the database will be. This could be configurable of course, but then the user has to do some serious configuration which will require technical knowledge, and of course set up a database. Too much effort I thinks.

Since:
20.12.09
Version:
01.00
Author:
Michael Couck

Nested Class Summary
 
Nested classes/interfaces inherited from interface com.ikokoon.serenity.persistence.IDataBase
IDataBase.DataBaseManager
 
Method Summary
 void close()
          Closes the database.
<E extends Composite<?,?>>
java.util.List<E>
find(java.lang.Class<E> klass)
          Selects all the classes of a particular type.
<E extends Composite<?,?>>
E
find(java.lang.Class<E> klass, java.util.List<java.lang.Object> parameters)
          Selects a class based on the combination of field values in the parameter list.
<E extends Composite<?,?>>
E
find(java.lang.Class<E> klass, java.lang.Long id)
          Selects a composite based on the class type and the id of the class.
<E extends Composite<?,?>>
java.util.List<E>
find(java.lang.Class<E> klass, java.util.Map<java.lang.String,java.lang.Object> parameters)
          Selects a list of objects based on the values in the objects and the class of the object.
 boolean isClosed()
          Checks the open status of the database.
<E extends Composite<?,?>>
E
persist(E composite)
          Persists an object to a persistent store.
<E extends Composite<?,?>>
E
remove(java.lang.Class<E> klass, java.lang.Long id)
          Removes an object from the database and returns the removed object as a convenience.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

find

public <E extends Composite<?,?>> E find(java.lang.Class<E> klass,
                                         java.lang.Long id)
Selects a composite based on the class type and the id of the class.

Type Parameters:
E - the return type of the class
Parameters:
klass - the type of class to select
id - the unique id of the class
Returns:
the composite with the specified id

find

public <E extends Composite<?,?>> E find(java.lang.Class<E> klass,
                                         java.util.List<java.lang.Object> parameters)
Description copied from interface: IDataBase
Selects a class based on the combination of field values in the parameter list.

Type Parameters:
E - the return type of the class
Parameters:
klass - the type of class to select
parameters - the unique combination of field values to select the class with
Returns:
the composite with the specified unique field combination

find

public <E extends Composite<?,?>> java.util.List<E> find(java.lang.Class<E> klass)
Selects all the classes of a particular type. Note this could potentially return the whole database.

Type Parameters:
E - the return type of the class
Parameters:
klass - the type of class to select
Returns:
a list of all the objects in the database that have the specified class type

find

public <E extends Composite<?,?>> java.util.List<E> find(java.lang.Class<E> klass,
                                                         java.util.Map<java.lang.String,java.lang.Object> parameters)
Selects a list of objects based on the values in the objects and the class of the object. The implementations can implement multiple search criteria including fuzzy selection etc.

Type Parameters:
E - the return type of the class
Parameters:
klass - the type of class to select
parameters - the parameters to do the selection with. These are the fields in the objects and the values
Returns:
the list of composites that match the selection criteria

isClosed

public boolean isClosed()
Checks the open status of the database.

Returns:
whether the database is open or closed

persist

public <E extends Composite<?,?>> E persist(E composite)
Persists an object to a persistent store.

Parameters:
composite - the composite to persist
Returns:
the composite that is persisted, typically the id will be set by the underlying implementation

remove

public <E extends Composite<?,?>> E remove(java.lang.Class<E> klass,
                                           java.lang.Long id)
Removes an object from the database and returns the removed object as a convenience.

Type Parameters:
E - the return type of the class
Parameters:
klass - the type of class to select
id - the unique id of the class
Returns:
the composite with the specified id

close

public void close()
Closes the database.



Copyright © 2010. All Rights Reserved.