org.apache.ojb.broker
Class ProxyExamples

java.lang.Object
  extended byjunit.framework.Assert
      extended byjunit.framework.TestCase
          extended byorg.apache.ojb.broker.ProxyExamples
All Implemented Interfaces:
junit.framework.Test

public class ProxyExamples
extends junit.framework.TestCase

Demo Application that shows basic concepts for Applications using the PersistenceBroker as a mediator for persistence


Field Summary
(package private)  PersistenceBroker broker
           
 
Constructor Summary
ProxyExamples(java.lang.String name)
          Insert the method's description here.
 
Method Summary
protected  Article createArticle(int id)
          Insert the method's description here.
static void main(java.lang.String[] args)
           
 void setUp()
          Insert the method's description here.
 void tearDown()
          Insert the method's description here.
 void testCollectionProxies()
           
 void testCollectionProxiesAndExtents()
           
 void testDynamicProxies()
          This example shows how the PersistenceBroker can be used with a highly configurable proxy concept.
 void testProgrammedProxies()
          This example shows how the PersistenceBroker can be used with a highly configurable proxy concept.
 void testProxiesAndJDBCTransactionIsolation()
          Default the transaction isolation level of a JDBC connection is READ-COMMITED.
 void testReferenceProxies()
           
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, run, run, runBare, runTest, setName, toString
 
Methods inherited from class junit.framework.Assert
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

broker

PersistenceBroker broker
Constructor Detail

ProxyExamples

public ProxyExamples(java.lang.String name)
Insert the method's description here. Creation date: (24.12.2000 00:33:40)

Method Detail

main

public static void main(java.lang.String[] args)

createArticle

protected Article createArticle(int id)
Insert the method's description here. Creation date: (06.12.2000 22:15:33)

Parameters:
id - int

setUp

public void setUp()
           throws PBFactoryException
Insert the method's description here. Creation date: (06.12.2000 21:58:53)

Throws:
PBFactoryException

tearDown

public void tearDown()
Insert the method's description here. Creation date: (06.12.2000 21:59:14)


testProgrammedProxies

public void testProgrammedProxies()
This example shows how the PersistenceBroker can be used with a highly configurable proxy concept. The main idea is, not to return materialized objects but rather lazy proxies, that defer materialization until it is definitely neccesary (e.g. reading an Objects attribute). To achieve such a behaviour, you can define proxies for each persistent class. As an example see the Repository.xml file in this examples directory. It is not always the best option to use lazy materialization. The usage of proxies can be completely configured in the xml repository. That is, if you decide not to use proxies, you don't have to change program-code, but only out-comment the corresponding entry in the repos itory.


testDynamicProxies

public void testDynamicProxies()
This example shows how the PersistenceBroker can be used with a highly configurable proxy concept. The main idea is, not to return materialized objects but rather lazy proxies, that defer materialization until it is definitely neccesary (e.g. reading an Objects attribute). To achieve such a behaviour, you can define proxies for each persistent class. As an example see the Repository.xml file in this examples directory. It is not always the best option to use lazy materialization. The usage of proxies can be completely configured in the xml repository. That is, if you decide not to use proxies, you don't have to change program-code, but only out-comment the corresponding entry in the repos itory.


testCollectionProxies

public void testCollectionProxies()

testCollectionProxiesAndExtents

public void testCollectionProxiesAndExtents()

testReferenceProxies

public void testReferenceProxies()

testProxiesAndJDBCTransactionIsolation

public void testProxiesAndJDBCTransactionIsolation()
Default the transaction isolation level of a JDBC connection is READ-COMMITED. So if a proxy uses another broker instance (i.e. JDBC connecction) than the current one, it's possible that program blocks.



Authors: Thomas Mahler and others. (C) 2000 - 2003 Apache Software Foundation
All rights reserved. Published under the Apache License.
http://db.apache.org/ojb
Version: 1.0.rc5, 2003-12-14