org.ujoframework.orm
Class OrmHandler

java.lang.Object
  extended by org.ujoframework.orm.OrmHandler

public class OrmHandler
extends java.lang.Object

The basic class for an ORM support.

Author:
Pavel Ponec

Constructor Summary
OrmHandler()
          The (Sigleton ?)
 
Method Summary
 void addProperty(UjoProperty property, MetaRelation2Many newColumn)
          Map a property to the table
 void config(MetaParams params)
          Save the ORM parameters.
 void config(MetaRoot config)
          Save the ORM configuration include parameters (if the parameters are not null).
 boolean config(java.lang.String url)
          Load parameters from an external XML file.
 boolean config(java.net.URL url, boolean throwsException)
          Load parameters from an external XML file.
 Session createSession()
          Create new session
TODO: getDefaultSession from a map by key.
 MetaRelation2Many findColumnModel(UjoProperty pathProperty)
          Find a Relation/Column model of the paramemeter property.
 MetaTable findTableModel(java.lang.Class<? extends OrmUjo> dbClass)
          Find a table model by the dbClass.
static OrmHandler getInstance()
          A candidate to removing
 MetaParams getParameters()
          Returns parameters
 Session getSession()
          Get Session
TODO: getDefaultSession from a map by key.
 boolean isPersistent(UjoProperty property)
          Is the parameter a persistent property?
<UJO extends OrmUjo>
void
loadDatabase(java.lang.Class<UJO>... databaseModels)
          Load a meta-data and create database tables
<UJO extends OrmUjo>
void
loadDatabase(java.lang.Class<UJO> databaseModel)
          Load a meta-data and create database tables
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OrmHandler

public OrmHandler()
The (Sigleton ?) constructor

Method Detail

getInstance

public static OrmHandler getInstance()
A candidate to removing


getSession

public Session getSession()
Get Session
TODO: getDefaultSession from a map by key.


createSession

public Session createSession()
Create new session
TODO: getDefaultSession from a map by key.


config

public boolean config(java.lang.String url)
               throws java.lang.IllegalArgumentException
Load parameters from an external XML file. The initialization must be finished before an ORM definition loading.

Throws:
java.lang.IllegalArgumentException

config

public void config(MetaParams params)
            throws java.lang.IllegalArgumentException
Save the ORM parameters. The assigning must be finished before an ORM definition loading.

Throws:
java.lang.IllegalArgumentException

config

public void config(MetaRoot config)
            throws java.lang.IllegalArgumentException
Save the ORM configuration include parameters (if the parameters are not null). The assigning must be finished before an ORM definition loading.

Throws:
java.lang.IllegalArgumentException

config

public boolean config(java.net.URL url,
                      boolean throwsException)
               throws java.lang.IllegalArgumentException
Load parameters from an external XML file. The initialization must be finished before an ORM definition loading.

Throws:
java.lang.IllegalArgumentException

isPersistent

public boolean isPersistent(UjoProperty property)
Is the parameter a persistent property?


loadDatabase

public final <UJO extends OrmUjo> void loadDatabase(java.lang.Class<UJO> databaseModel)
Load a meta-data and create database tables


loadDatabase

public <UJO extends OrmUjo> void loadDatabase(java.lang.Class<UJO>... databaseModels)
Load a meta-data and create database tables


addProperty

public void addProperty(UjoProperty property,
                        MetaRelation2Many newColumn)
Map a property to the table


findColumnModel

public MetaRelation2Many findColumnModel(UjoProperty pathProperty)
Find a Relation/Column model of the paramemeter property.

Parameters:
pathProperty - Parameter can be type of Property of PathProperty (direct or indirect);
Returns:
Related model or the null if model was not found.

findTableModel

public MetaTable findTableModel(java.lang.Class<? extends OrmUjo> dbClass)
Find a table model by the dbClass. Returns null of table is not found.


getParameters

public MetaParams getParameters()
Returns parameters



Copyright © 2009. All Rights Reserved.