You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-dev@db.apache.org by ar...@apache.org on 2004/05/18 01:42:27 UTC
cvs commit: db-ojb/forrest/src/documentation/content/xdocs/docu metadata.xml howto-use-anonymous-keys.xml basic-technique.xml
arminw 2004/05/17 16:42:27
Modified: forrest/src/documentation skinconf.xml
forrest/src/documentation/content/xdocs/docu metadata.xml
howto-use-anonymous-keys.xml basic-technique.xml
Log:
add + change docs
minor change in skinconf
Revision Changes Path
1.4 +11 -8 db-ojb/forrest/src/documentation/skinconf.xml
Index: skinconf.xml
===================================================================
RCS file: /home/cvs/db-ojb/forrest/src/documentation/skinconf.xml,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- skinconf.xml 15 May 2004 15:17:03 -0000 1.3
+++ skinconf.xml 17 May 2004 23:42:27 -0000 1.4
@@ -109,23 +109,26 @@
font-size : 90%;
padding: 1em 1.33em 1em 1.33em;
background : #EEEEEE;}
-.codefrag {font-family: "Courier New", Courier, monospace; font-size : 95%;}
-.warningmessage {font-size : 90%;}
-.infomessage {font-size : 90%;}
-.errormessage {font-size : 90%;}
+.codefrag {font-family: "Courier New", Courier, monospace; font-size : 100%;}
+.warningmessage {font-size : 85%;}
+.infomessage {font-size : 85%;}
+.errormessage {font-size : 85%;}
</extra-css>
<colors>
- <color name="menu" value="#f7f7f7" link="#000000" vlink="#000000" hlink="#000000"/>
- <color name="navstrip" value="#dddddd" link="#801458" vlink="##009999" hlink="#801458"/>
- <color name="body" value="#ffffff" link="#801458" vlink="#009999" hlink="#805840"/>
+ <color name="body" value="#ffffff" link="#801458" vlink="#801458" hlink="#b4005a"/>
+
+ <color name="menu" value="#f7f7f7" link="#801458" vlink="#801458" hlink="#b4005a"/>
+ <color name="navstrip" value="#dddddd" link="#801458" vlink="#801458" hlink="#801458"/>
+
<color name="heading" value="#2c3c6d"/>
<color name="subheading" value="#bbbdce"/>
+
<color name="fixme" value="#6c85b0"/>
<color name="note" value="#84145a"/>
<color name="warning" value="#b2a510"/>
- <color name="footer" value="#dedfde"/>
+ <color name="footer" value="#dedfde"/>
<!-- Krysalis -->
<!--
1.4 +26 -7 db-ojb/forrest/src/documentation/content/xdocs/docu/metadata.xml
Index: metadata.xml
===================================================================
RCS file: /home/cvs/db-ojb/forrest/src/documentation/content/xdocs/docu/metadata.xml,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- metadata.xml 12 May 2004 16:06:11 -0000 1.3
+++ metadata.xml 17 May 2004 23:42:27 -0000 1.4
@@ -213,14 +213,22 @@
Each persistence capable java object must be declared in a corresponding
<link href="site:repository/class-descriptor">class-descriptor</link>.
</p>
+ <anchor id="global-repository"/>
<p>
The
<em>ClassDescriptor</em> instances are managed by
<link href="ext:api/descriptor-repository">
<code>org.apache.ojb.broker.metadata.DescriptorRepository</code>
</link>.
- Per default OJB use only one global instance of this class.
+ Per default OJB use only <strong>one global instance</strong> of this class - it's
+ the repository file read at startup of OJB. But it is possible to change the global
+ use repository:
</p>
+ <source><![CDATA[
+// get MetadataManager instance
+MetadataManager mm = MetadataManager.getInstance();
+
+mm.setDescriptor(myGlobalRepository, true);]]></source>
<anchor id="load-object-metadata"/>
<section>
@@ -298,7 +306,7 @@
provide several methods to read/set and manipulate object metadata.
</p>
<p>
- Per default OJB use a global instance of class
+ Per default OJB use a <link href="#global-repository">global instance</link> of class
<link href="ext:api/descriptor-repository">
<em>DescriptorRepository</em>
</link> to manage all
@@ -320,7 +328,7 @@
<section>
<title>Per thread metadata changes</title>
<p>
- Per default the manager handle one global
+ Per default the manager handle <link href="#global-repository">one global</link>
<link href="ext:api/descriptor-repository">
<em>DescriptorRepository</em>
</link> for all calling threads
@@ -335,18 +343,20 @@
metadata, but the recommended way is to use
<link href="#metadata-profiles">metadata profiles</link>.
</p>
+ <anchor id="per-thread-mode"/>
<p>
To enable the use of different
<em>DescriptorRepository</em> instances for each thread do:
</p>
- <anchor id="per-thread-mode"/>
<source><![CDATA[
MetadataManager mm = MetadataManager.getInstance();
// tell the manager to use per thread mode
mm.setEnablePerThreadChanges(true);
...]]></source>
<p>
- This can be done e.g. at start up or at runtime when it's needed.
+ This can be done e.g. at start up or at runtime when it's needed. If method
+ <code>setEnablePerThreadChanges</code> is set <em>false</em> only the
+ <link href="#global-repository"><em>global DescriptorRepository</em></link> was used.
Now it's possible to use dedicated DescriptorRepository instances per thread:
</p>
<source><![CDATA[
@@ -425,7 +435,16 @@
<section>
<title>Pitfalls</title>
<p>
-
+ OJB's flexibility of <em>metadata handling</em> demanded specific attention
+ on object caching. If a <link href="site:object-cache">global cache</link>
+ (shared permanent cache) was used, be aware of side-effects caused by runtime
+ metadata changes.
+ </p>
+ <p>
+ For example, using two metadata profiles <em>A</em> and <em>B</em>. In profile A all
+ fields of a class are showed, in profile B only the 'name filed' is showed. Thread 1 use
+ profile A, thread 2 use profile B. It is obvious that a global shared cache will cause
+ trouble.
</p>
</section>
</section>
1.4 +3 -5 db-ojb/forrest/src/documentation/content/xdocs/docu/howto-use-anonymous-keys.xml
Index: howto-use-anonymous-keys.xml
===================================================================
RCS file: /home/cvs/db-ojb/forrest/src/documentation/content/xdocs/docu/howto-use-anonymous-keys.xml,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- howto-use-anonymous-keys.xml 28 Apr 2004 08:03:52 -0000 1.3
+++ howto-use-anonymous-keys.xml 17 May 2004 23:42:27 -0000 1.4
@@ -90,8 +90,7 @@
// optional getter/setter
....
-{
- ]]></source>
+{]]></source>
<p>
When using <em>anonymous keys</em> the FK field will become obsolete:
</p>
@@ -103,8 +102,7 @@
// optional getter/setter
....
-{
- ]]></source>
+{]]></source>
<note>
Under specific conditions it's also possible to use anonymous keys for other relations
or primary keys. More info
1.7 +61 -58 db-ojb/forrest/src/documentation/content/xdocs/docu/basic-technique.xml
Index: basic-technique.xml
===================================================================
RCS file: /home/cvs/db-ojb/forrest/src/documentation/content/xdocs/docu/basic-technique.xml,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- basic-technique.xml 9 May 2004 13:50:30 -0000 1.6
+++ basic-technique.xml 17 May 2004 23:42:27 -0000 1.7
@@ -52,14 +52,15 @@
of the referenced
<code>productgroup</code>
is stored in the attribute
- <code>productGroupId</code>.
+ <code>productGroupId</code>. To avoid FK attribute in persistent object class
+ see section about <link href="site:advanced-technique/anonymous-keys">anonymous keys</link>.
</p>
<p>
This is the DDL of the underlying tables:
</p>
<source><![CDATA[
- CREATE TABLE Artikel
- (
+CREATE TABLE Artikel
+(
Artikel_Nr INT NOT NULL PRIMARY KEY,
Artikelname VARCHAR(60),
Lieferanten_Nr INT,
@@ -70,14 +71,14 @@
BestellteEinheiten INT,
MindestBestand INT,
Auslaufartikel INT
- )
+)
- CREATE TABLE Kategorien
- (
+CREATE TABLE Kategorien
+(
Kategorie_Nr INT NOT NULL PRIMARY KEY,
KategorieName VARCHAR(20),
Beschreibung VARCHAR(60)
- )]]></source>
+)]]></source>
<p>
To declare the foreign key mechanics of this reference attribute we
have to add a reference-descriptor to the class-descriptor of the
@@ -117,44 +118,44 @@
the Article ClassDescriptor:
</p>
<source><![CDATA[
- <!-- Definitions for org.apache.ojb.ojb.broker.Article -->
- <class-descriptor
- class="org.apache.ojb.broker.Article"
- proxy="dynamic"
- table="Artikel"
- >
- <extent-class class-ref="org.apache.ojb.broker.BookArticle" />
- <extent-class class-ref="org.apache.ojb.broker.CdArticle" />
- <field-descriptor
- name="articleId"
- column="Artikel_Nr"
- jdbc-type="INTEGER"
- primarykey="true"
- autoincrement="true"
- />
- <field-descriptor
- name="articleName"
- column="Artikelname"
- jdbc-type="VARCHAR"
- />
- <field-descriptor
- name="supplierId"
- column="Lieferanten_Nr"
- jdbc-type="INTEGER"
- />
- <field-descriptor
- name="productGroupId"
- column="Kategorie_Nr"
- jdbc-type="INTEGER"
- />
- ...
- <reference-descriptor
- name="productGroup"
- class-ref="org.apache.ojb.broker.ProductGroup"
- >
- <foreignkey field-ref="productGroupId"/>
- </reference-descriptor>
- </class-descriptor>]]></source>
+<!-- Definitions for org.apache.ojb.ojb.broker.Article -->
+<class-descriptor
+ class="org.apache.ojb.broker.Article"
+ proxy="dynamic"
+ table="Artikel"
+>
+ <extent-class class-ref="org.apache.ojb.broker.BookArticle" />
+ <extent-class class-ref="org.apache.ojb.broker.CdArticle" />
+ <field-descriptor
+ name="articleId"
+ column="Artikel_Nr"
+ jdbc-type="INTEGER"
+ primarykey="true"
+ autoincrement="true"
+ />
+ <field-descriptor
+ name="articleName"
+ column="Artikelname"
+ jdbc-type="VARCHAR"
+ />
+ <field-descriptor
+ name="supplierId"
+ column="Lieferanten_Nr"
+ jdbc-type="INTEGER"
+ />
+ <field-descriptor
+ name="productGroupId"
+ column="Kategorie_Nr"
+ jdbc-type="INTEGER"
+ />
+ ...
+ <reference-descriptor
+ name="productGroup"
+ class-ref="org.apache.ojb.broker.ProductGroup"
+ >
+ <foreignkey field-ref="productGroupId"/>
+ </reference-descriptor>
+</class-descriptor>]]></source>
<p>
This example provides unidirectional navigation only. Bidirectional
navigation may be added by including a reference from a ProductGroup to a
@@ -173,6 +174,8 @@
<code>sampleArticleId</code>
to the
<em>ProductGroup</em> class representing the foreign key.
+ To avoid FK attribute in persistent object class see section about
+ <link href="site:advanced-technique/anonymous-keys">anonymous keys</link>.
</li>
<li>
Add a column
@@ -186,22 +189,22 @@
</li>
</ol>
<source><![CDATA[
- <field-descriptor
- name="sampleArticleId"
- column="SAMPLE_ARTICLE_ID"
- jdbc-type="INTEGER"
- />]]></source>
+<field-descriptor
+ name="sampleArticleId"
+ column="SAMPLE_ARTICLE_ID"
+ jdbc-type="INTEGER"
+/>]]></source>
<ol>
<li>Add a ReferenceDescriptor to the ClassDescriptor of the Class
ProductGroup:</li>
</ol>
<source><![CDATA[
- <reference-descriptor
- name="sampleArticle"
- class-ref="org.apache.ojb.broker.Article"
- >
- <foreignkey field-ref="sampleArticleId""/>
- </reference-descriptor>]]></source>
+<reference-descriptor
+ name="sampleArticle"
+ class-ref="org.apache.ojb.broker.Article"
+>
+ <foreignkey field-ref="sampleArticleId""/>
+</reference-descriptor>]]></source>
<section>
@@ -1433,7 +1436,7 @@
implementations that are used by OJB to replace lists. The default
set proxy class is
<code>org.apache.ojb.broker.core.proxy.ListProxyDefaultImpl</code>
-
+
</li>
<li>
<strong>Set proxies</strong> are specific <code>java.util.Set</code>
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org