JAC project
AOPSYS
CEDRIC & LIP6 labs

org.objectweb.jac.aspects.distrans.persistence
Class SimpleDbPersistence

java.lang.Object
  |
  +--org.objectweb.jac.aspects.distrans.persistence.SimpleDbPersistence
All Implemented Interfaces:
PersistenceItf

public class SimpleDbPersistence
extends Object
implements PersistenceItf

Basic transaction-enabled persistence storage. Data is stored in SQL tables. Each table contains object field values and owns one more attribute than its associated class contains field. The additional attribute stores the object name.

Version:
1.0
Author:
Lionel Seinturier

Constructor Summary
SimpleDbPersistence()
           
 
Method Summary
 void initStorage(String className, org.enhydra.jdbc.standard.StandardXADataSource ds)
          Create a SQL table to hold persistent data.
 void initStorageIfNeeded(String className, org.enhydra.jdbc.standard.StandardXADataSource ds)
          Create a SQL table to hold persistent data.
 void load(Object wrappee, String name, org.enhydra.jdbc.standard.StandardXADataSource ds)
          Store an object into the persistence storage.
 void store(Object wrappee, String name, org.enhydra.jdbc.standard.StandardXADataSource ds)
          Update an object with the values retrieved from the persistent storage.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleDbPersistence

public SimpleDbPersistence()
Method Detail

initStorageIfNeeded

public void initStorageIfNeeded(String className,
                                org.enhydra.jdbc.standard.StandardXADataSource ds)
Create a SQL table to hold persistent data. Implements PersistenceItf#createStorageIfNeeded() The table is not created if it already exists. This enables to reuse existing tables to map their content to JAC objects. However, this may cause problems if the schema is different than the expected one. In such a case, call createStorage instead.

Specified by:
initStorageIfNeeded in interface PersistenceItf
Parameters:
className - the class name for which we want to create a table
ds - the data source

initStorage

public void initStorage(String className,
                        org.enhydra.jdbc.standard.StandardXADataSource ds)
Create a SQL table to hold persistent data. If the table exists, it is deleted first. Implements PersistenceItf#createStorage()

Specified by:
initStorage in interface PersistenceItf
Parameters:
className - the class name for which we want to create a table
ds - the data source

load

public void load(Object wrappee,
                 String name,
                 org.enhydra.jdbc.standard.StandardXADataSource ds)
          throws SQLException,
                 IllegalArgumentException,
                 IllegalAccessException,
                 NotSupportedException,
                 SecurityException,
                 IllegalStateException,
                 RollbackException,
                 HeuristicMixedException,
                 HeuristicRollbackException,
                 SystemException
Store an object into the persistence storage. Implements PersistenceItf#load()

Specified by:
load in interface PersistenceItf
Parameters:
wrappee - the object to store
name - the identifier for the object
ds - the data source
SQLException
IllegalArgumentException
IllegalAccessException
NotSupportedException
SecurityException
IllegalStateException
RollbackException
HeuristicMixedException
HeuristicRollbackException
SystemException

store

public void store(Object wrappee,
                  String name,
                  org.enhydra.jdbc.standard.StandardXADataSource ds)
           throws Exception
Update an object with the values retrieved from the persistent storage. Implements PersistenceItf#store()

Specified by:
store in interface PersistenceItf
Parameters:
wrappee - the object to update
name - the identifier for the object
ds - the data source
Exception

Contact JAC development team:
Renaud Pawlak
Lionel Seinturier
Laurent Martelli