svn commit: r592987 [1/2] - in /db/ojb/trunk/src/xdoclet: ./ java/src/xdoclet/modules/ojb/ java/src/xdoclet/modules/ojb/constraints/ sample/ sample/java/ sample/java/org/ sample/java/org/apache/ sample/java/org/apache/ojb/ sample/java/org/apache/ojb/sa...
[email protected] Thu, 08 Nov 2007 01:03:01 -0000
| Newsgroups | gmane.comp.jakarta.ojb.devel |
|---|---|
| Message-ID | <[email protected]> |
Author: arminw
Date: Wed Nov 7 17:02:59 2007
New Revision: 592987
URL: http://svn.apache.org/viewvc?rev=592987&view=rev
Log:
synchronize with OJB_1_0_RELEASE branch
Added:
db/ojb/trunk/src/xdoclet/ojb-doclipse.xml
db/ojb/trunk/src/xdoclet/sample/
db/ojb/trunk/src/xdoclet/sample/java/
db/ojb/trunk/src/xdoclet/sample/java/org/
db/ojb/trunk/src/xdoclet/sample/java/org/apache/
db/ojb/trunk/src/xdoclet/sample/java/org/apache/ojb/
db/ojb/trunk/src/xdoclet/sample/java/org/apache/ojb/sample/
db/ojb/trunk/src/xdoclet/sample/java/org/apache/ojb/sample/Author.java
db/ojb/trunk/src/xdoclet/sample/java/org/apache/ojb/sample/AuthorDetail.java
db/ojb/trunk/src/xdoclet/sample/java/org/apache/ojb/sample/BasicObject.java
db/ojb/trunk/src/xdoclet/sample/java/org/apache/ojb/sample/Book.java
db/ojb/trunk/src/xdoclet/sample/java/org/apache/ojb/sample/CD.java
db/ojb/trunk/src/xdoclet/sample/java/org/apache/ojb/sample/DVD.java
db/ojb/trunk/src/xdoclet/sample/java/org/apache/ojb/sample/Medium.java
db/ojb/trunk/src/xdoclet/sample/java/org/apache/ojb/sample/ProductGroup.java
db/ojb/trunk/src/xdoclet/sample/java/org/apache/ojb/sample/Publisher.java
db/ojb/trunk/src/xdoclet/sample/java/org/apache/ojb/sample/PublisherImpl.java
db/ojb/trunk/src/xdoclet/sample/java/org/apache/ojb/sample/Review.java
db/ojb/trunk/src/xdoclet/sample/java/org/apache/ojb/sample/SampleTest.java
Removed:
db/ojb/trunk/src/xdoclet/ojb.xml
Modified:
db/ojb/trunk/src/xdoclet/java/src/xdoclet/modules/ojb/OjbMemberTagsHandler.java
db/ojb/trunk/src/xdoclet/java/src/xdoclet/modules/ojb/OjbTagsHandler.java
db/ojb/trunk/src/xdoclet/java/src/xdoclet/modules/ojb/constraints/ClassDescriptorConstraints.java
db/ojb/trunk/src/xdoclet/java/src/xdoclet/modules/ojb/constraints/CollectionDescriptorConstraints.java
db/ojb/trunk/src/xdoclet/java/src/xdoclet/modules/ojb/constraints/FieldDescriptorConstraints.java
db/ojb/trunk/src/xdoclet/java/src/xdoclet/modules/ojb/constraints/ReferenceDescriptorConstraints.java
Modified: db/ojb/trunk/src/xdoclet/java/src/xdoclet/modules/ojb/OjbMemberTagsHandler.java
URL: http://svn.apache.org/viewvc/db/ojb/trunk/src/xdoclet/java/src/xdoclet/modules/ojb/OjbMemberTagsHandler.java?rev=592987&r1=592986&r2=592987&view=diff
==============================================================================
--- db/ojb/trunk/src/xdoclet/java/src/xdoclet/modules/ojb/OjbMemberTagsHandler.java (original)
+++ db/ojb/trunk/src/xdoclet/java/src/xdoclet/modules/ojb/OjbMemberTagsHandler.java Wed Nov 7 17:02:59 2007
@@ -1,20 +1,25 @@
package xdoclet.modules.ojb;
-/* Copyright 2003-2005 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
+
import java.util.*;
import xjavadoc.*;
@@ -48,6 +53,25 @@
}
else if (getCurrentMethod() != null) {
return MethodTagsHandler.getPropertyNameFor(getCurrentMethod());
+ }
+ else {
+ return null;
+ }
+ }
+
+ /**
+ * Returns the name of the current member class.
+ *
+ * @return The member class name
+ * @exception XDocletException if an error occurs
+ */
+ public static String getMemberClassName() throws XDocletException
+ {
+ if (getCurrentField() != null) {
+ return getCurrentField().getContainingClass().getQualifiedName();
+ }
+ else if (getCurrentMethod() != null) {
+ return getCurrentMethod().getContainingClass().getQualifiedName();
}
else {
return null;
Modified: db/ojb/trunk/src/xdoclet/java/src/xdoclet/modules/ojb/OjbTagsHandler.java
URL: http://svn.apache.org/viewvc/db/ojb/trunk/src/xdoclet/java/src/xdoclet/modules/ojb/OjbTagsHandler.java?rev=592987&r1=592986&r2=592987&view=diff
==============================================================================
--- db/ojb/trunk/src/xdoclet/java/src/xdoclet/modules/ojb/OjbTagsHandler.java (original)
+++ db/ojb/trunk/src/xdoclet/java/src/xdoclet/modules/ojb/OjbTagsHandler.java Wed Nov 7 17:02:59 2007
@@ -1781,7 +1781,12 @@
{
if (OjbMemberTagsHandler.getMemberDimension() > 0)
{
- return JdbcTypeHelper.JDBC_DEFAULT_CONVERSION;
+ LogHelper.warn(true, OjbTagsHandler.class, "getDefaultJdbcConversionForCurrentMember",
+ "Class '" + OjbMemberTagsHandler.getMemberClassName()
+ + ", field '" + OjbMemberTagsHandler.getMemberName()
+ + "': Array type detected, a FieldConversion NEEDED?");
+ //return JdbcTypeHelper.JDBC_DEFAULT_CONVERSION;
+ return null;
}
String type = OjbMemberTagsHandler.getMemberType().getQualifiedName();
Modified: db/ojb/trunk/src/xdoclet/java/src/xdoclet/modules/ojb/constraints/ClassDescriptorConstraints.java
URL: http://svn.apache.org/viewvc/db/ojb/trunk/src/xdoclet/java/src/xdoclet/modules/ojb/constraints/ClassDescriptorConstraints.java?rev=592987&r1=592986&r2=592987&view=diff
==============================================================================
--- db/ojb/trunk/src/xdoclet/java/src/xdoclet/modules/ojb/constraints/ClassDescriptorConstraints.java (original)
+++ db/ojb/trunk/src/xdoclet/java/src/xdoclet/modules/ojb/constraints/ClassDescriptorConstraints.java Wed Nov 7 17:02:59 2007
@@ -458,7 +458,12 @@
}
catch (ClassNotFoundException ex)
{
- throw new ConstraintException("Could not find the class "+ex.getMessage()+" on the classpath while checking the row-reader class "+rowReaderName+" of class "+classDef.getName());
+ // throw new ConstraintException("Could not find the class "+ex.getMessage()+" on the classpath while checking the row-reader class "+rowReaderName+" of class "+classDef.getName());
+ LogHelper.warn(true,
+ ClassDescriptorConstraints.class,
+ "checkRowReader",
+ "Class '" + classDef.getQualifiedName() + "', RowReader name '"
+ + rowReaderName + "' can't be resolved - SHORTCUT NAME or typo?");
}
}
@@ -501,7 +506,12 @@
}
catch (ClassNotFoundException ex)
{
- throw new ConstraintException("Could not find the class "+ex.getMessage()+" on the classpath while checking the object-cache class "+objectCacheName+" of class "+classDef.getName());
+ //throw new ConstraintException("Could not find the class "+ex.getMessage()+" on the classpath while checking the object-cache class "+objectCacheName+" of class "+classDef.getName());
+ LogHelper.warn(true,
+ ClassDescriptorConstraints.class,
+ "checkObjectCache",
+ "Class '" + classDef.getQualifiedName() + "', ObjectCache name '"
+ + objectCacheName + "' can't be resolved - SHORTCUT NAME or typo?");
}
}
Modified: db/ojb/trunk/src/xdoclet/java/src/xdoclet/modules/ojb/constraints/CollectionDescriptorConstraints.java
URL: http://svn.apache.org/viewvc/db/ojb/trunk/src/xdoclet/java/src/xdoclet/modules/ojb/constraints/CollectionDescriptorConstraints.java?rev=592987&r1=592986&r2=592987&view=diff
==============================================================================
--- db/ojb/trunk/src/xdoclet/java/src/xdoclet/modules/ojb/constraints/CollectionDescriptorConstraints.java (original)
+++ db/ojb/trunk/src/xdoclet/java/src/xdoclet/modules/ojb/constraints/CollectionDescriptorConstraints.java Wed Nov 7 17:02:59 2007
@@ -1,27 +1,33 @@
package xdoclet.modules.ojb.constraints;
import xdoclet.modules.ojb.CommaListIterator;
+import xdoclet.modules.ojb.LogHelper;
import xdoclet.modules.ojb.model.ClassDescriptorDef;
import xdoclet.modules.ojb.model.CollectionDescriptorDef;
import xdoclet.modules.ojb.model.FieldDescriptorDef;
import xdoclet.modules.ojb.model.ModelDef;
import xdoclet.modules.ojb.model.PropertyHelper;
-/* Copyright 2004-2005 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
+
/**
* Checks constraints for collection descriptors. Note that constraints may modify the collection descriptor.
* For checks of the relationships (e.g. foreignkey) see ModelConstraints.
@@ -212,7 +218,13 @@
}
catch (ClassNotFoundException ex)
{
- throw new ConstraintException("Could not find the class "+ex.getMessage()+" on the classpath while checking the collection "+collDef.getName()+" in class "+collDef.getOwner().getName());
+ // throw new ConstraintException("Could not find the class "+ex.getMessage()+" on the classpath while checking the collection "+collDef.getName()+" in class "+collDef.getOwner().getName());
+ LogHelper.warn(true,
+ CollectionDescriptorConstraints.class,
+ "ensureCollectionClass",
+ "Class '" + collDef.getOwner().getName() + "', field '" + collDef.getName()
+ + "': Specified collection-class '" + specifiedClass
+ + "' can't be resolved - SHORTCUT NAME or typo?");
}
}
}
Modified: db/ojb/trunk/src/xdoclet/java/src/xdoclet/modules/ojb/constraints/FieldDescriptorConstraints.java
URL: http://svn.apache.org/viewvc/db/ojb/trunk/src/xdoclet/java/src/xdoclet/modules/ojb/constraints/FieldDescriptorConstraints.java?rev=592987&r1=592986&r2=592987&view=diff
==============================================================================
--- db/ojb/trunk/src/xdoclet/java/src/xdoclet/modules/ojb/constraints/FieldDescriptorConstraints.java (original)
+++ db/ojb/trunk/src/xdoclet/java/src/xdoclet/modules/ojb/constraints/FieldDescriptorConstraints.java Wed Nov 7 17:02:59 2007
@@ -1,12 +1,12 @@
package xdoclet.modules.ojb.constraints;
import java.util.HashMap;
+import java.util.Locale;
import xdoclet.modules.ojb.LogHelper;
import xdoclet.modules.ojb.model.FieldDescriptorDef;
import xdoclet.modules.ojb.model.PropertyHelper;
import xdoclet.modules.ojb.model.ClassDescriptorDef;
-import org.apache.commons.lang.SystemUtils;
/*
* Licensed to the Apache Software Foundation (ASF) under one
@@ -71,6 +71,7 @@
_jdbcTypes.put("REF", null);
_jdbcTypes.put("BOOLEAN", null);
_jdbcTypes.put("DATALINK", null);
+ _jdbcTypes.put("JAVA_OBJECT", null);
}
/**
@@ -165,10 +166,10 @@
}
fieldDef.setProperty(PropertyHelper.OJB_PROPERTY_JDBC_TYPE, fieldDef.getProperty(PropertyHelper.OJB_PROPERTY_DEFAULT_JDBC_TYPE));
- if (!fieldDef.hasProperty(PropertyHelper.OJB_PROPERTY_CONVERSION) && fieldDef.hasProperty(PropertyHelper.OJB_PROPERTY_DEFAULT_CONVERSION))
- {
- fieldDef.setProperty(PropertyHelper.OJB_PROPERTY_CONVERSION, fieldDef.getProperty(PropertyHelper.OJB_PROPERTY_DEFAULT_CONVERSION));
- }
+// if (!fieldDef.hasProperty(PropertyHelper.OJB_PROPERTY_CONVERSION) && fieldDef.hasProperty(PropertyHelper.OJB_PROPERTY_DEFAULT_CONVERSION))
+// {
+// fieldDef.setProperty(PropertyHelper.OJB_PROPERTY_CONVERSION, fieldDef.getProperty(PropertyHelper.OJB_PROPERTY_DEFAULT_CONVERSION));
+// }
}
else
{
@@ -178,13 +179,22 @@
if (!_jdbcTypes.containsKey(jdbcType))
{
- throw new ConstraintException("The field "+fieldDef.getName()+" in class "+fieldDef.getOwner().getName()+" specifies the invalid jdbc type "+jdbcType);
+ if(!_jdbcTypes.containsKey(jdbcType.toUpperCase(Locale.ENGLISH)))
+ {
+ throw new ConstraintException("The field "+fieldDef.getName()+" in class "+fieldDef.getOwner().getName()+" specifies the invalid jdbc type "+jdbcType);
+ }
+ else
+ {
+ // replace with correct upper case
+ fieldDef.setProperty(PropertyHelper.OJB_PROPERTY_JDBC_TYPE, jdbcType.toUpperCase(Locale.ENGLISH));
+ }
}
}
}
/**
- * Constraint that ensures that the field has a conversion if the java type requires it. Also checks the conversion class.
+ * Constraint that ensures that the field has a conversion if the java type requires it.
+ * Also checks the conversion class.
*
* @param fieldDef The field descriptor
* @param checkLevel The current check level (this constraint is checked in basic (partly) and strict)
@@ -234,7 +244,12 @@
}
catch (ClassNotFoundException ex)
{
- throw new ConstraintException("The class "+ex.getMessage()+" hasn't been found on the classpath while checking the conversion class specified for field "+fieldDef.getName()+" in class "+fieldDef.getOwner().getName());
+ //throw new ConstraintException("The class "+ex.getMessage()+" hasn't been found on the classpath while checking the conversion class specified for field "+fieldDef.getName()+" in class "+fieldDef.getOwner().getName());
+ LogHelper.warn(true,
+ FieldDescriptorConstraints.class,
+ "ensureConversion",
+ "Class '"+fieldDef.getOwner().getName() + "', field '" + fieldDef.getName() +
+ "': FieldConversion class '" + conversionClass + "' can't be resolved - SHORTCUT NAME or typo?");
}
}
}
Modified: db/ojb/trunk/src/xdoclet/java/src/xdoclet/modules/ojb/constraints/ReferenceDescriptorConstraints.java
URL: http://svn.apache.org/viewvc/db/ojb/trunk/src/xdoclet/java/src/xdoclet/modules/ojb/constraints/ReferenceDescriptorConstraints.java?rev=592987&r1=592986&r2=592987&view=diff
==============================================================================
--- db/ojb/trunk/src/xdoclet/java/src/xdoclet/modules/ojb/constraints/ReferenceDescriptorConstraints.java (original)
+++ db/ojb/trunk/src/xdoclet/java/src/xdoclet/modules/ojb/constraints/ReferenceDescriptorConstraints.java Wed Nov 7 17:02:59 2007
@@ -122,10 +122,12 @@
{
// no, so defer the check but issue a warning
performCheck = false;
- LogHelper.warn(true,
- getClass(),
- "ensureClassRef",
- "Cannot check whether the type "+targetClassDef.getQualifiedName()+" specified as class-ref at reference "+refDef.getName()+" in class "+ownerClassDef.getName()+" is assignable to the declared type "+varType+" of the reference because this variable type cannot be found in source or on the classpath");
+ LogHelper.warn(true, getClass(), "ensureClassRef",
+ "Cannot check whether the type " + targetClassDef.getQualifiedName()
+ + " specified as class-ref at reference " + refDef.getName()
+ + " in class "+ownerClassDef.getName()
+ + " is assignable to the declared type " + varType
+ + " of the reference because this variable type cannot be found in source or on the classpath");
}
}
if (performCheck && !helper.isSameOrSubTypeOf(targetClassDef, varType, true))
Added: db/ojb/trunk/src/xdoclet/ojb-doclipse.xml
URL: http://svn.apache.org/viewvc/db/ojb/trunk/src/xdoclet/ojb-doclipse.xml?rev=592987&view=auto
==============================================================================
--- db/ojb/trunk/src/xdoclet/ojb-doclipse.xml (added)
+++ db/ojb/trunk/src/xdoclet/ojb-doclipse.xml Wed Nov 7 17:02:59 2007
@@ -0,0 +1,552 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+-->
+
+<!-- @version $Id: ojb-doclipse.xml 592984 2007-11-08 00:48:47Z arminw $ -->
+<!-- OJB's Doclipse definition file. See http://beust.com/doclipse/ -->
+
+<doclipse>
+ <description>Tags for the OJB XDoclet module</description>
+
+ <tag name="@ojb.class"
+ target="class"
+ doc="Declares that this class is persistent via OJB">
+ <attribute name="accept-locks"
+ allowed="true false"
+ doc="For ODMG: specifies whether implicit locks propagate to this class, with a value of false, this class can never be locked; default value is 'true'"/>
+ <attribute name="attributes"
+ doc="Contains attributes of the class as name-value pairs of the form 'name1=value1,name2=value2'"/>
+ <attribute name="determine-extents"
+ allowed="true false"
+ doc="Whether the XDoclet OJB module should determine the extents (direct subtypes); default value is 'true'"/>
+ <attribute name="documentation"
+ doc="Documentation for the class"/>
+ <attribute name="factory-class"
+ doc="A different class that is used to create instances of this class"/>
+ <attribute name="factory-method"
+ doc="A usually static method in the factory-class that creates new instances of this class"/>
+ <attribute name="generate-table-info"
+ allowed="true false"
+ doc="Whether this class should be present in the database"/>
+ <attribute name="include-inherited"
+ allowed="true false"
+ doc="Whether the XDoclet OJB module should automatically copy all persistent fields/references/collections from the superclasses into the descriptor for this class; default value is 'true'"/>
+ <attribute name="initialization-method"
+ doc="This method will be called whenever a new instance of this class has been created by OJB"/>
+ <attribute name="isolation-level"
+ allowed="read-uncommitted read-committed repeatable-read serializable optimistic none"
+ doc="For ODMG: the transactional isolation level; default is 'read-uncommitted'"/>
+ <attribute name="proxy"
+ doc="Determines whether proxies are used for instances of this class; can be 'dynamic' for automatic dynamic proxies, or the fully qualified class name of the proxy class to use"/>
+ <attribute name="proxy-prefetching-limit"
+ doc="Determines how many objects are prefetched when a collection of this type is read from the database; use 0 to turn this off"/>
+ <attribute name="refresh"
+ allowed="true false"
+ doc="Forces OJB to refresh instances of this type when loaded from the cache; default value is 'false'"/>
+ <attribute name="row-reader"
+ doc="Gives the fully qualified name of the class that reads instances of this class from the database"/>
+ <attribute name="schema"
+ doc="Contains the database schema owning the table mapped to this class"/>
+ <attribute name="table"
+ doc="The database table onto which this class is mapped"/>
+ <attribute name="field-class"
+ doc="The field-class attribute can be used to override the PersistentField implementation class.
+ OJB's shortcut name feature is supported."/>
+ <attribute name="state-detection"
+ allowed="on off inherit"
+ doc="The state-detection attribute is used by API's supporting automatic state detection of
+ persistence capable objects (automatic detection of changed object fields - e.g. like
+ the ODMG implementation). The attribute indicate whether or not the object state detection
+ is enabled for this class or if it's inherited from a higher level entity."/>
+ </tag>
+
+ <tag name="@ojb.object-cache"
+ target="class"
+ doc="Specifies which object cache implementation shall be used for this class">
+ <attribute name="attributes"
+ doc="Contains attributes for the object cache instance as name-value pairs of the form 'name1=value1,name2=value2'"/>
+ <attribute name="class"
+ required="true"
+ doc="Specifies the fully qualified name of the object cache implementation class. OJB's shortcut name feature is supported"/>
+ <attribute name="documentation"
+ doc="Documentation for the object cache"/>
+ </tag>
+
+ <tag name="@ojb.extent-class"
+ target="class"
+ doc="Specifies an extent, a subclass with an @ojb.class tag. This tag is only evaluated if the value of the determine-extents attribute of this class is set to 'false'">
+ <attribute name="class-ref"
+ doc="The fully qualified name of the subclass"/>
+ </tag>
+
+ <tag name="@ojb.modify-inherited"
+ target="class"
+ doc="Use this tag to modify attributes of inherited fields/references/collections">
+ <attribute name="access"
+ allowed="readonly readwrite"
+ doc="For fields: modifies the 'access' attribute of the inherited feature"/>
+ <attribute name="attributes"
+ doc="For fields, references, collections: modifies the 'attributes' attribute of the inherited feature"/>
+ <attribute name="autoincrement"
+ allowed="none ojb database"
+ doc="For fields: modifies the 'autoincrement' attribute of the inherited feature"/>
+ <attribute name="auto-delete"
+ allowed="none link object true false"
+ doc="For references, collections: modifies the 'auto-delete' attribute of the inherited feature"/>
+ <attribute name="auto-retrieve"
+ allowed="true false"
+ doc="For references, collections: modifies the 'auto-retrieve' attribute of the inherited feature"/>
+ <attribute name="auto-update"
+ allowed="true false none link create object"
+ doc="For references, collections: modifies the 'auto-update' attribute of the inherited feature"/>
+ <attribute name="class-ref"
+ doc="For references: modifies the 'class-ref' attribute of the inherited feature"/>
+ <attribute name="collection-class"
+ doc="For collections: modifies the 'collection-class' attribute of the inherited feature"/>
+ <attribute name="column"
+ doc="For fields: modifies the 'column' attribute of the inherited feature"/>
+ <attribute name="conversion"
+ doc="For fields: modifies the 'conversion' attribute of the inherited feature"/>
+ <attribute name="default-fetch"
+ allowed="true false"
+ doc="For fields: modifies the 'default-fetch' attribute of the inherited feature"/>
+ <attribute name="documentation"
+ doc="For fields, references, collections: modifies the 'documentation' attribute of the inherited feature"/>
+ <attribute name="element-class-ref"
+ doc="For collections: modifies the 'element-class-ref' attribute of the inherited feature"/>
+ <attribute name="foreignkey"
+ required="true"
+ doc="For references, collections: modifies the 'foreignkey' attribute of the inherited feature"/>
+ <attribute name="id"
+ doc="For fields: modifies the 'id' attribute of the inherited feature"/>
+ <attribute name="indexed"
+ allowed="true false"
+ doc="For fields: modifies the 'indexed' attribute of the inherited feature"/>
+ <attribute name="jdbc-type"
+ allowed="BIT BOOLEAN TINYINT SMALLINT INTEGER BIGINT DOUBLE FLOAT REAL NUMERIC DECIMAL CHAR VARCHAR LONGVARCHAR DATE TIME TIMESTAMP BINARY VARBINARY LONGVARBINARY CLOB BLOB STRUCT ARRAY REF DATALINK JAVA_OBJECT"
+ doc="For fields: modifies the 'jdbc-type' attribute of the inherited feature"/>
+ <attribute name="length"
+ doc="For fields: modifies the 'length' attribute of the inherited feature"/>
+ <attribute name="locking"
+ allowed="true false"
+ doc="For fields: modifies the 'locking' attribute of the inherited feature"/>
+ <attribute name="name"
+ required="true"
+ doc="The name of the inherited feature that will be modified for the current class"/>
+ <attribute name="nullable"
+ allowed="true false"
+ doc="For fields: modifies the 'nullable' attribute of the inherited feature"/>
+ <attribute name="orderby"
+ doc="For collection: modifies the 'orderby' attribute of the inherited feature"/>
+ <attribute name="otm-dependent"
+ allowed="true false"
+ doc="DEPRECATED! For references, collections: modifies the 'otm-dependent' attribute of the inherited feature"/>
+ <attribute name="precision"
+ doc="For fields: modifies the 'precision' attribute of the inherited feature"/>
+ <attribute name="primarykey"
+ allowed="true false"
+ doc="For fields: modifies the 'primarykey' attribute of the inherited feature"/>
+ <attribute name="proxy"
+ allowed="true false"
+ doc="For references, collections: modifies the 'proxy' attribute of the inherited feature"/>
+ <attribute name="proxy-prefetching-limit"
+ doc="For references, collections: modifies the 'proxy-prefetching-limit' attribute of the inherited feature"/>
+ <attribute name="refresh"
+ allowed="true false"
+ doc="For references, collections: modifies the 'refresh' attribute of the inherited feature"/>
+ <attribute name="scale"
+ doc="For fields: modifies the 'scale' attribute of the inherited feature"/>
+ <attribute name="sequence-name"
+ doc="For fields: modifies the 'sequence-name' attribute of the inherited feature"/>
+ <attribute name="table"
+ doc="Overrides the table attribute of the field tag"/>
+ <attribute name="update-lock"
+ allowed="true false"
+ doc="For fields: modifies the 'update-lock' attribute of the inherited feature"/>
+ <attribute name="isolation-level"
+ allowed="read-uncommitted read-committed repeatable-read serializable optimistic none"
+ doc="For ODMG: the transactional isolation level; default is 'read-uncommitted'"/>
+ <attribute name="state-detection"
+ allowed="on off inherit"
+ doc="The state-detection attribute is used by API's supporting automatic state detection of
+ persistence capable objects (automatic detection of changed object fields - e.g. like
+ the ODMG implementation). The attribute indicate whether or not the object state detection
+ is enabled for this class or if it's inherited from a higher level entity."/>
+ <attribute name="field-class"
+ doc="The field-class attribute can be used to override the PersistentField implementation class.
+ OJB's shortcut name feature is supported."/>
+ <attribute name="query-customizer"
+ doc="For collections: modifies the 'query-customizer' attribute of the inherited feature"/>
+ <attribute name="query-customizer-attributes"
+ doc="For collections: modifies the 'query-customizer-attributes' attribute of the inherited feature"/>
+ <attribute name="ignore"
+ allowed="true false"
+ doc="If set to 'true', then the feature will not be included in the class descriptor for the current class. Default value is 'false'"/>
+ </tag>
+
+ <tag name="@ojb.index"
+ target="class"
+ doc="Defines an index for this class">
+ <attribute name="documentation"
+ doc="Documentation for the index"/>
+ <attribute name="fields"
+ required="true"
+ doc="Specifies the fields of this class in a comma-separated list that make up the index"/>
+ <attribute name="name"
+ required="true"
+ doc="The name of the index"/>
+ <attribute name="unique"
+ allowed="true false"
+ doc="Whether this is a unique index; default value is 'false'"/>
+ </tag>
+
+ <tag name="@ojb.field"
+ target="class method field"
+ doc="Declares a persistent field">
+ <attribute name="access"
+ allowed="readonly readwrite"
+ doc="Specifies whether OJB can modify the value of the column that corresponds to this field"/>
+ <attribute name="attributes"
+ doc="Contains attributes of the field as name-value pairs of the form 'name1=value1,name2=value2'"/>
+ <attribute name="autoincrement"
+ allowed="none ojb database"
+ doc="Defines the source of the value for this field. 'None' means that the value is application-provided, with 'ojb' the value is generated by the current sequence manager, and 'database' stands for a value that is generated by the database. Default value is 'none'"/>
+ <attribute name="column"
+ doc="The database column that this field is mapped to"/>
+ <attribute name="conversion"
+ doc="Specifies a class that converts the field value to the type of the column and vice versa"/>
+ <attribute name="default-fetch"
+ allowed="true false"
+ doc="For JDO: Whether this field belongs to a JDO default fetch group; default value is 'false'"/>
+ <attribute name="documentation"
+ doc="Documentation for the field"/>
+ <attribute name="id"
+ doc="Gives the ordering of the fields in the generated descriptor"/>
+ <attribute name="indexed"
+ allowed="true false"
+ doc="Specifies whether there is an index on this field (the default index). Default value is 'false'"/>
+ <attribute name="jdbc-type"
+ allowed="BIT BOOLEAN TINYINT SMALLINT INTEGER BIGINT DOUBLE FLOAT REAL NUMERIC DECIMAL CHAR VARCHAR LONGVARCHAR DATE TIME TIMESTAMP BINARY VARBINARY LONGVARBINARY CLOB BLOB STRUCT ARRAY REF DATALINK JAVA_OBJECT"
+ doc="The jdbc type of the column corresponding to this field"/>
+ <attribute name="length"
+ doc="Gives the length setting if the jdbc type of the column requires it"/>
+ <attribute name="locking"
+ allowed="true false"
+ doc="Declares that this field is used for optimistic locking. Can only be set for field with a jdbc type of TIMESTAMP or INTEGER. Default value is 'false'"/>
+ <attribute name="name"
+ doc="The name of the field. Only relevant for anonymous fields which are declared in the javadoc of the class because they have no corresponding java field"/>
+ <attribute name="nullable"
+ allowed="true false"
+ doc="Whether the column corresponding to this field can contain 'null' values"/>
+ <attribute name="precision"
+ doc="Gives the precision setting if the jdbc type of the column requires it"/>
+ <attribute name="primarykey"
+ allowed="true false"
+ doc="Whether this field is part of the primarykey of the class. Default value is 'false'"/>
+ <attribute name="scale"
+ doc="Gives the scale setting if the jdbc type of the column requires it"/>
+ <attribute name="sequence-name"
+ doc="The name of the sequence that gives the values for this field if autoincrement is set to 'ojb'"/>
+ <attribute name="update-lock"
+ allowed="true false"
+ doc="If locking is set to 'true' then this attribute specifies whether OJB will update this locking field or the database. Default is 'true' meaning that OJB does the update"/>
+ <attribute name="state-detection"
+ allowed="on off inherit"
+ doc="The state-detection attribute is used by API's supporting automatic state detection of
+ persistence capable objects (automatic detection of changed object fields - e.g. like
+ the ODMG implementation). The attribute indicate whether or not the object state detection
+ is enabled for this class or if it's inherited from a higher level entity."/>
+ <attribute name="field-class"
+ doc="The field-class attribute can be used to override the PersistentField implementation class.
+ OJB's shortcut name feature is supported."/>
+ </tag>
+ <tag name="@ojb.reference"
+ target="class method field"
+ doc="">
+ <attribute name="attributes"
+ doc="Contains attributes of the reference as name-value pairs of the form 'name1=value1,name2=value2'"/>
+ <attribute name="auto-delete"
+ allowed="none link object true false"
+ doc="Specifies what OJB should do with the referenced object when deleting an instance of this class from the database; default value is 'false'"/>
+ <attribute name="auto-retrieve"
+ allowed="true false"
+ doc="Specifies whether OJB should also load the referenced object when loading an instance of this class from the database; default value is 'true'"/>
+ <attribute name="auto-update"
+ allowed="none link create object true false"
+ doc="Specifies what OJB should do with the referenced object when udpating an instance of this class in the database; default value is 'false'"/>
+ <attribute name="class-ref"
+ doc="The fully qualified name of the referenced class. Should only be necessary when if the declared class is different from actual referenced class"/>
+ <attribute name="documentation"
+ doc="Documentation for the reference"/>
+ <attribute name="foreignkey"
+ required="true"
+ doc="Specifies the fields (comma-separated list) in this class that hold the primarykey value of the referenced object"/>
+ <attribute name="otm-dependent"
+ allowed="true false"
+ doc="Specifies whether the OTM layer automatically creates the referred object or deletes it if the reference field is set to null. Default value is 'false'"/>
+ <attribute name="proxy"
+ allowed="true false"
+ doc="Whether to use proxy-based lazy loading for this reference. Default value is 'false'"/>
+ <attribute name="proxy-prefetching-limit"
+ doc="Specifies how many objects are prefetched when loading the reference for the first instance of this class when part of some collection. Set to 0 to disable this"/>
+ <attribute name="refresh"
+ allowed="true false"
+ doc="Forces OJB to refresh the reference when the object is reloaded; default value is 'false'"/>
+ </tag>
+ <tag name="@ojb.collection"
+ target="method field"
+ doc="">
+ <attribute name="attributes"
+ doc="Contains attributes of the collection as name-value pairs of the form 'name1=value1,name2=value2'"/>
+ <attribute name="auto-delete"
+ allowed="none link object true false"
+ doc="Specifies what OJB should do with the collection elements when deleting an instance of this class from the database; default value is 'false'"/>
+ <attribute name="auto-retrieve"
+ allowed="true false"
+ doc="Specifies whether OJB should also load the elements of the collection when loading an instance of this class from the database; default value is 'true'"/>
+ <attribute name="auto-update"
+ allowed="none link create object true false"
+ doc="Specifies what OJB should do with the collection elements when updating an instance of this class in the database; default value is 'false'"/>
+ <attribute name="collection-class"
+ doc="Gives the fully qualified name of the class that realizes the collection. OJB's shortcut name feature is supported."/>
+ <attribute name="documentation"
+ doc="Documentation for the collection"/>
+ <attribute name="element-class-ref"
+ doc="The fully qualified name of the type of the elements which is required to have an @ojb.class tag"/>
+ <attribute name="foreignkey"
+ required="true"
+ doc="Specifies a comma-separated list of the fields in the element type (1:n collection) or columns in the indirection table (m:n collection) that point to this class by containing the primarykey value"/>
+ <attribute name="indirection-table"
+ doc="Contains the name of the indirection table for m:n collections"/>
+ <attribute name="orderby"
+ doc="Specifies the fields that define the ordering of the collection, in the form 'field1=ASC,field2=DESC' with ASC for ascending and DESC for descending ordering"/>
+ <attribute name="otm-dependent"
+ allowed="true false"
+ doc="Specifies whether the OTM layer automatically creates collection elements that were included into the collectionelements and deletes collection elements that were excluded from the collection. Default value is 'false'"/>
+ <attribute name="proxy"
+ allowed="true false"
+ doc="Whether to use proxy-based lazy loading for this collection. Default value is 'false'"/>
+ <attribute name="proxy-prefetching-limit"
+ doc="Specifies how many objects are prefetched when loading the collection for the first instance of this class when part of some collection. Set to 0 to disable this"/>
+ <attribute name="query-customizer"
+ doc="Contains the fully qualified name of a class that customizes the original query that would load this collection"/>
+ <attribute name="query-customizer-attributes"
+ doc="Contains attributes for the query customizer as name-value pairs of the form 'name1=value1,name2=value2'"/>
+ <attribute name="refresh"
+ allowed="true false"
+ doc="Forces OJB to refresh the collection when the object is reloaded; default value is 'false'"/>
+ <attribute name="remote-foreignkey"
+ doc="Use this attribute for m:n collections to specify the columns in the indirection table that point to the element type in cases where the element type has no collection pointing to this class"/>
+ </tag>
+ <tag name="@ojb.nested"
+ target="method field"
+ doc=""/>
+ <tag name="@ojb.modify-nested"
+ target="method field"
+ doc="Use this tag to modify attributes of nested fields/references/collections">
+ <attribute name="access"
+ allowed="readonly readwrite"
+ doc="For fields: modifies the 'access' attribute of the nested feature"/>
+ <attribute name="attributes"
+ doc="For fields, references, collections: modifies the 'attributes' attribute of the nested feature"/>
+ <attribute name="auto-delete"
+ allowed="none link object true false"
+ doc="For references, collections: modifies the 'auto-delete' attribute of the nested feature"/>
+ <attribute name="auto-retrieve"
+ allowed="true false"
+ doc="For references, collections: modifies the 'auto-retrieve' attribute of the nested feature"/>
+ <attribute name="auto-update"
+ allowed="none link create object true false"
+ doc="For references, collections: modifies the 'auto-update' attribute of the nested feature"/>
+ <attribute name="autoincrement"
+ allowed="none ojb database"
+ doc="For fields: modifies the 'autoincrement' attribute of the nested feature"/>
+ <attribute name="class-ref"
+ doc="For references: modifies the 'class-ref' attribute of the nested feature"/>
+ <attribute name="collection-class"
+ doc="For collections: modifies the 'collection-class' attribute of the nested feature"/>
+ <attribute name="column"
+ doc="For fields: modifies the 'column' attribute of the nested feature"/>
+ <attribute name="conversion"
+ doc="For fields: modifies the 'conversion' attribute of the nested feature"/>
+ <attribute name="default-fetch"
+ allowed="true false"
+ doc="For fields: modifies the 'default-fetch' attribute of the nested feature"/>
+ <attribute name="documentation"
+ doc="For fields, references, collections: modifies the 'documentation' attribute of the nested feature"/>
+ <attribute name="element-class-ref"
+ doc="For collections: modifies the 'element-class-ref' attribute of the nested feature"/>
+ <attribute name="foreignkey"
+ required="true"
+ doc="For references, collections: modifies the 'foreignkey' attribute of the nested feature"/>
+ <attribute name="id"
+ doc="For fields: modifies the 'id' attribute of the nested feature"/>
+ <attribute name="indexed"
+ allowed="true false"
+ doc="For fields: modifies the 'indexed' attribute of the nested feature"/>
+ <attribute name="jdbc-type"
+ allowed="BIT BOOLEAN TINYINT SMALLINT INTEGER BIGINT DOUBLE FLOAT REAL NUMERIC DECIMAL CHAR VARCHAR LONGVARCHAR DATE TIME TIMESTAMP BINARY VARBINARY LONGVARBINARY CLOB BLOB STRUCT ARRAY REF DATALINK JAVA_OBJECT"
+ doc="For fields: modifies the 'jdbc-type' attribute of the nested feature"/>
+ <attribute name="length"
+ doc="For fields: modifies the 'length' attribute of the nested feature"/>
+ <attribute name="locking"
+ allowed="true false"
+ doc="For fields: modifies the 'locking' attribute of the nested feature"/>
+ <attribute name="name"
+ required="true"
+ doc="The name of the nested feature that will be modified for the current class"/>
+ <attribute name="nullable"
+ allowed="true false"
+ doc="For fields: modifies the 'nullable' attribute of the nested feature"/>
+ <attribute name="orderby"
+ doc="For collection: modifies the 'orderby' attribute of the nested feature"/>
+ <attribute name="otm-dependent"
+ allowed="true false"
+ doc="For references, collections: modifies the 'otm-dependent' attribute of the nested feature"/>
+ <attribute name="precision"
+ doc="For fields: modifies the 'precision' attribute of the nested feature"/>
+ <attribute name="primarykey"
+ allowed="true false"
+ doc="For fields: modifies the 'primarykey' attribute of the nested feature"/>
+ <attribute name="proxy"
+ allowed="true false"
+ doc="For references, collections: modifies the 'proxy' attribute of the nested feature"/>
+ <attribute name="proxy-prefetching-limit"
+ doc="For references, collections: modifies the 'proxy-prefetching-limit' attribute of the nested feature"/>
+ <attribute name="query-customizer"
+ doc="For collections: modifies the 'query-customizer' attribute of the nested feature"/>
+ <attribute name="query-customizer-attributes"
+ doc="For collections: modifies the 'query-customizer-attributes' attribute of the nested feature"/>
+ <attribute name="refresh"
+ allowed="true false"
+ doc="For references, collections: modifies the 'refresh' attribute of the nested feature"/>
+ <attribute name="scale"
+ doc="For fields: modifies the 'scale' attribute of the nested feature"/>
+ <attribute name="sequence-name"
+ doc="For fields: modifies the 'sequence-name' attribute of the nested feature"/>
+ <attribute name="update-lock"
+ allowed="true false"
+ doc="For fields: modifies the 'update-lock' attribute of the nested feature"/>
+ <attribute name="state-detection"
+ allowed="on off inherit"
+ doc="For fields: modifies the 'state-detection' attribute of the nested feature.
+ The state-detection attribute is used by API's supporting automatic state detection of
+ persistence capable objects (automatic detection of changed object fields - e.g. like
+ the ODMG implementation). The attribute indicate whether or not the object state detection
+ is enabled for this class or if it's inherited from a higher level entity."/>
+ <attribute name="field-class"
+ doc="For fields: modifies the 'field-class' attribute of the nested feature.
+ The field-class attribute can be used to override the PersistentField implementation class.
+ OJB's shortcut name feature is supported."/>
+ <attribute name="ignore"
+ allowed="true false"
+ doc="If set to 'true', then the feature will not be included in the class descriptor for the current class. Default value is 'false'"/>
+ </tag>
+
+ <tag name="@ojb.delete-procedure"
+ target="class"
+ doc="Specifies a procedure/function that handles deletion of objects in the database">
+ <attribute name="arguments"
+ doc="A comma-separated list of names that identify the constant-argument and/or runtime-argument tags at this class which belong to this delete procedure"/>
+ <attribute name="attributes"
+ doc="Contains attributes for the delete procedure as name-value pairs of the form 'name1=value1,name2=value2'"/>
+ <attribute name="documentation"
+ doc="Documentation for the delete procedure"/>
+ <attribute name="include-pk-only"
+ allowed="true false"
+ doc="If set to 'true', then all persistent fields of this class marked as primareykeys will be passed to the delete procedure, and the arguments attribute will be ignored; default value is 'false'"/>
+ <attribute name="name"
+ required="true"
+ doc="The name of the delete procedure"/>
+ <attribute name="return-field-ref"
+ doc="Specifies the field that will receive the return value of this delete procedure"/>
+ </tag>
+
+ <tag name="@ojb.insert-procedure"
+ target="class"
+ doc="">
+ <attribute name="arguments"
+ doc="A comma-separated list of names that identify the constant-argument and/or runtime-argument tags at this class which belong to this insert procedure"/>
+ <attribute name="attributes"
+ doc="Contains attributes for the insert procedure as name-value pairs of the form 'name1=value1,name2=value2'"/>
+ <attribute name="documentation"
+ doc="Documentation for the insert procedure"/>
+ <attribute name="include-all-fields"
+ allowed="true false"
+ doc="If set to 'true', then all persistent fields of this class will be passed to the insert procedure, and the arguments attribute will be ignored; default value is 'false'"/>
+ <attribute name="name"
+ required="true"
+ doc="The name of the insert procedure"/>
+ <attribute name="return-field-ref"
+ doc="Specifies the field that will receive the return value of this insert procedure"/>
+ </tag>
+
+ <tag name="@ojb.update-procedure"
+ target="class"
+ doc="">
+ <attribute name="arguments"
+ doc="A comma-separated list of names that identify the constant-argument and/or runtime-argument tags at this class which belong to this procedure"/>
+ <attribute name="attributes"
+ doc="Contains attributes for the update procedure as name-value pairs of the form 'name1=value1,name2=value2'"/>
+ <attribute name="documentation"
+ doc="Documentation for the update procedure"/>
+ <attribute name="include-all-fields"
+ allowed="true false"
+ doc="If set to 'true', then all persistent fields of this class will be passed to the update procedure, and the arguments attribute will be ignored; default value is 'false'"/>
+ <attribute name="name"
+ required="true"
+ doc="The name of the update procedure"/>
+ <attribute name="return-field-ref"
+ doc="Specifies the field that will receive the return value of this update procedure"/>
+ </tag>
+
+ <tag name="@ojb.constant-argument"
+ target="class"
+ doc="Defines a constant argument to be used by a delete, insert or update procedure">
+ <attribute name="attributes"
+ doc="Contains attributes of the argument as name-value pairs of the form 'name1=value1,name2=value2'"/>
+ <attribute name="documentation"
+ doc="Documentation for the argument"/>
+ <attribute name="value"
+ doc="The constant value"/>
+ <attribute name="name"
+ required="true"
+ doc="The name of the argument"/>
+ </tag>
+
+ <tag name="@ojb.runtime-argument"
+ target="class"
+ doc="Defines a runtime argument to be used by a delete, insert or update procedure">
+ <attribute name="attributes"
+ doc="Contains attributes of the argument as name-value pairs of the form 'name1=value1,name2=value2'"/>
+ <attribute name="documentation"
+ doc="Documentation for the argument"/>
+ <attribute name="field-ref"
+ doc="Specifies the field whose value is passed to the procedure; if not specified, then 'null' is used as tje value"/>
+ <attribute name="name"
+ required="true"
+ doc="The name of the argument"/>
+ <attribute name="return"
+ allowed="true false"
+ doc="Whether this is a return value rather than a parameter to the procedure"/>
+ </tag>
+</doclipse>
Added: db/ojb/trunk/src/xdoclet/sample/java/org/apache/ojb/sample/Author.java
URL: http://svn.apache.org/viewvc/db/ojb/trunk/src/xdoclet/sample/java/org/apache/ojb/sample/Author.java?rev=592987&view=auto
==============================================================================
--- db/ojb/trunk/src/xdoclet/sample/java/org/apache/ojb/sample/Author.java (added)
+++ db/ojb/trunk/src/xdoclet/sample/java/org/apache/ojb/sample/Author.java Wed Nov 7 17:02:59 2007
@@ -0,0 +1,140 @@
+package org.apache.ojb.sample;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * The Author class
+ *
+ * FK's only used in a 1:1 reference can use an "anonymous field" (no FK field in java class).
+ * @ojb.class
+ * @ojb.field name="fkAuthorDetail" jdbc-type="INTEGER"
+ */
+public class Author extends BasicObject
+{
+ /**
+ * @ojb.field
+ */
+ private String name;
+ // This field is used by a 1:1 and target of an 1:n reference in class PublisherImpl
+ // so it's not recommended to use an "anonymous field". But we can declare it as
+ // private field without getter/setter with a specific PersistentField implementation
+ // class called 'direct' (the OJB shortcut name)
+ /**
+ * @ojb.field field-class="direct"
+ */
+ private Integer fkPublisher;
+ /**
+ * @ojb.reference foreignkey="fkPublisher" auto-retrieve="true"
+ * auto-update="create" auto-delete="none" proxy="true"
+ */
+ private Publisher publisher;
+ /**
+ * @ojb.reference foreignkey="fkAuthorDetail" auto-retrieve="true"
+ * auto-update="create" auto-delete="none" proxy="true"
+ */
+ private AuthorDetail authorDetail;
+ /**
+ * @ojb.collection element-class-ref="org.apache.ojb.sample.Medium"
+ * indirection-table="MEDIUM_AUTHOR"
+ * foreignkey="authorId"
+ * auto-retrieve="true"
+ * auto-update="create"
+ * auto-delete="none"
+ * proxy="true"
+ */
+ private List media;
+
+ public Author()
+ {
+ }
+
+ public boolean equals(Object obj)
+ {
+ return super.equals(obj);
+ }
+
+ public Author(String name, List books)
+ {
+ this.name = name;
+ this.media = books;
+ }
+
+ public void addMedia(Medium medium)
+ {
+ if (media == null)
+ {
+ media = new ArrayList();
+ }
+ if (!media.contains(medium))
+ {
+ media.add(medium);
+ medium.addAuthor(this);
+ }
+ }
+
+ public boolean removeMedia(Medium medium)
+ {
+ boolean result = false;
+ if (media != null)
+ {
+ result = media.remove(medium);
+ if (result) medium.removeAuthor(this);
+ }
+ return result;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
+ public List getMedia()
+ {
+ return media;
+ }
+
+ public Publisher getPublisher()
+ {
+ return publisher;
+ }
+
+ public void setPublisher(Publisher publisher)
+ {
+ this.publisher = publisher;
+ }
+
+ public AuthorDetail getAuthorDetail()
+ {
+ return authorDetail;
+ }
+
+ public void setAuthorDetail(AuthorDetail authorDetail)
+ {
+ this.authorDetail = authorDetail;
+ }
+}
Added: db/ojb/trunk/src/xdoclet/sample/java/org/apache/ojb/sample/AuthorDetail.java
URL: http://svn.apache.org/viewvc/db/ojb/trunk/src/xdoclet/sample/java/org/apache/ojb/sample/AuthorDetail.java?rev=592987&view=auto
==============================================================================
--- db/ojb/trunk/src/xdoclet/sample/java/org/apache/ojb/sample/AuthorDetail.java (added)
+++ db/ojb/trunk/src/xdoclet/sample/java/org/apache/ojb/sample/AuthorDetail.java Wed Nov 7 17:02:59 2007
@@ -0,0 +1,73 @@
+package org.apache.ojb.sample;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/**
+ * Details class of Author class
+ *
+ * @ojb.class
+ * @version $Id$
+ */
+public class AuthorDetail extends BasicObject
+{
+ /**
+ * @ojb.field
+ */
+ private String bio;
+ // use PersistentFieldDirectImpl, no getter/setter required
+ /**
+ * @ojb.field field-class="direct"
+ */
+ private Integer fkAuthor;
+ /**
+ * @ojb.reference foreignkey="fkAuthor" auto-retrieve="true"
+ * auto-update="create" auto-delete="none" proxy="true"
+ */
+ private Author author;
+
+ public AuthorDetail()
+ {
+ }
+
+ public AuthorDetail(String bio)
+ {
+ this.bio = bio;
+ }
+
+ public String getBio()
+ {
+ return bio;
+ }
+
+ public void setBio(String bio)
+ {
+ this.bio = bio;
+ }
+
+ public Author getAuthor()
+ {
+ return author;
+ }
+
+ public void setAuthor(Author author)
+ {
+ this.author = author;
+ }
+}
Added: db/ojb/trunk/src/xdoclet/sample/java/org/apache/ojb/sample/BasicObject.java
URL: http://svn.apache.org/viewvc/db/ojb/trunk/src/xdoclet/sample/java/org/apache/ojb/sample/BasicObject.java?rev=592987&view=auto
==============================================================================
--- db/ojb/trunk/src/xdoclet/sample/java/org/apache/ojb/sample/BasicObject.java (added)
+++ db/ojb/trunk/src/xdoclet/sample/java/org/apache/ojb/sample/BasicObject.java Wed Nov 7 17:02:59 2007
@@ -0,0 +1,77 @@
+package org.apache.ojb.sample;
+
+import java.io.Serializable;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/**
+ * A base class.
+ *
+ * IMPORTANT: Don't declare a 'ojb.class' tag, because this is only a base class
+ * and we only need the base fields in the sub-classes (xdoclet shouldn't generate
+ * the table- or mapping-info for this class).
+ *
+ * @version $Id$
+ */
+class BasicObject implements Serializable
+{
+ /**
+ * @ojb.field autoincrement="ojb" primarykey="true" field-class="direct"
+ */
+ Integer id;
+
+ /**
+ * @ojb.field locking="true" field-class="direct"
+ */
+ Integer version;
+
+ public Integer getId()
+ {
+ return id;
+ }
+
+ public Integer getVersion()
+ {
+ return version;
+ }
+
+ public boolean equals(Object obj)
+ {
+ if (obj != null && obj.getClass().equals(this.getClass()))
+ {
+ BasicObject tmp = (BasicObject) obj;
+ if (tmp.getId() != null)
+ {
+ return tmp.getId().equals(this.getId());
+ }
+ else
+ {
+ return tmp == this;
+ }
+ }
+ return false;
+ }
+
+ public int hashCode()
+ {
+ // this could cause problems, but I don't know a better way
+ return id != null ? getId().hashCode() : 0;
+ }
+}
Added: db/ojb/trunk/src/xdoclet/sample/java/org/apache/ojb/sample/Book.java
URL: http://svn.apache.org/viewvc/db/ojb/trunk/src/xdoclet/sample/java/org/apache/ojb/sample/Book.java?rev=592987&view=auto
==============================================================================
--- db/ojb/trunk/src/xdoclet/sample/java/org/apache/ojb/sample/Book.java (added)
+++ db/ojb/trunk/src/xdoclet/sample/java/org/apache/ojb/sample/Book.java Wed Nov 7 17:02:59 2007
@@ -0,0 +1,40 @@
+package org.apache.ojb.sample;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.util.Date;
+
+/**
+ * The Book class
+ *
+ * @ojb.class
+ * @version $Id$
+ */
+public class Book extends Medium
+{
+ public Book()
+ {
+ }
+
+ public Book(String title, Date publicationDate, byte[] cover)
+ {
+ super(title, publicationDate, cover);
+ }
+}
Added: db/ojb/trunk/src/xdoclet/sample/java/org/apache/ojb/sample/CD.java
URL: http://svn.apache.org/viewvc/db/ojb/trunk/src/xdoclet/sample/java/org/apache/ojb/sample/CD.java?rev=592987&view=auto
==============================================================================
--- db/ojb/trunk/src/xdoclet/sample/java/org/apache/ojb/sample/CD.java (added)
+++ db/ojb/trunk/src/xdoclet/sample/java/org/apache/ojb/sample/CD.java Wed Nov 7 17:02:59 2007
@@ -0,0 +1,40 @@
+package org.apache.ojb.sample;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.util.Date;
+
+/**
+ * The CD class
+ *
+ * @ojb.class
+ * @version $Id$
+ */
+public class CD extends Medium
+{
+ public CD()
+ {
+ }
+
+ public CD(String title, Date publicationDate, byte[] cover)
+ {
+ super(title, publicationDate, cover);
+ }
+}
Added: db/ojb/trunk/src/xdoclet/sample/java/org/apache/ojb/sample/DVD.java
URL: http://svn.apache.org/viewvc/db/ojb/trunk/src/xdoclet/sample/java/org/apache/ojb/sample/DVD.java?rev=592987&view=auto
==============================================================================
--- db/ojb/trunk/src/xdoclet/sample/java/org/apache/ojb/sample/DVD.java (added)
+++ db/ojb/trunk/src/xdoclet/sample/java/org/apache/ojb/sample/DVD.java Wed Nov 7 17:02:59 2007
@@ -0,0 +1,40 @@
+package org.apache.ojb.sample;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.util.Date;
+
+/**
+ * The DVD class
+ *
+ * @ojb.class
+ * @version $Id$
+ */
+public class DVD extends Medium
+{
+ public DVD()
+ {
+ }
+
+ public DVD(String title, Date publicationDate, byte[] cover)
+ {
+ super(title, publicationDate, cover);
+ }
+}
Added: db/ojb/trunk/src/xdoclet/sample/java/org/apache/ojb/sample/Medium.java
URL: http://svn.apache.org/viewvc/db/ojb/trunk/src/xdoclet/sample/java/org/apache/ojb/sample/Medium.java?rev=592987&view=auto
==============================================================================
--- db/ojb/trunk/src/xdoclet/sample/java/org/apache/ojb/sample/Medium.java (added)
+++ db/ojb/trunk/src/xdoclet/sample/java/org/apache/ojb/sample/Medium.java Wed Nov 7 17:02:59 2007
@@ -0,0 +1,224 @@
+package org.apache.ojb.sample;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+import org.apache.commons.lang.builder.ToStringBuilder;
+import org.apache.commons.lang.builder.ToStringStyle;
+
+/**
+ * A "medium" base class
+ *
+ * FK's only used in a 1:1 reference can use an "anonymous field" (no FK field in java class).
+ * @ojb.class generate-table-info="false"
+ * @ojb.field name="fkPublisher" jdbc-type="INTEGER"
+ * @version $Id$
+ */
+public abstract class Medium extends BasicObject
+{
+ /**
+ * @ojb.field
+ */
+ private String title;
+ /**
+ * @ojb.field jdbc-type="TIMESTAMP" conversion="JavaData2SqlTimestamp"
+ */
+ private Date publicationDate;
+ /**
+ * @ojb.field jdbc-type="LONGVARBINARY"
+ */
+ private byte[] cover;
+ // This field is used by a 1:1 and target of an 1:n reference in class ProductGroup
+ // so it's not recommended to use an "anonymous field". But we can declare it as
+ // private field without getter/setter with a specific PersistentField implementation
+ // class called 'direct' (the OJB shortcut name)
+ /**
+ * @ojb.field field-class="direct"
+ */
+ private Integer fkProductGroup;
+
+ /**
+ * @ojb.reference foreignkey="fkProductGroup" auto-retrieve="true"
+ * auto-update="create" auto-delete="none" proxy="true"
+ */
+ private ProductGroup productGroup;
+ /**
+ * @ojb.reference foreignkey="fkPublisher" auto-retrieve="true"
+ * auto-update="create" auto-delete="none" proxy="true"
+ */
+ private Publisher publisher;
+
+
+ /**
+ * @ojb.collection element-class-ref="org.apache.ojb.sample.Author"
+ * indirection-table="MEDIUM_AUTHOR"
+ * foreignkey="mediumId"
+ * auto-retrieve="true"
+ * auto-update="create"
+ * auto-delete="none"
+ * proxy="true"
+ */
+ private List authors;
+ /**
+ * @ojb.collection element-class-ref="org.apache.ojb.sample.Review"
+ * foreignkey="fkMedium"
+ * auto-retrieve="true"
+ * auto-update="create"
+ * auto-delete="none"
+ * proxy="true"
+ */
+ private List reviews;
+
+ public Medium()
+ {
+ }
+
+ public Medium(String title, Date publicationDate, byte[] cover)
+ {
+ this.title = title;
+ this.publicationDate = publicationDate;
+ this.cover = cover;
+ }
+
+ public String toString()
+ {
+ return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
+ .append("id", id).append("title", title).append(
+ "publicationDate", publicationDate).append("version",
+ version).append(
+ "cover", cover).append("authors.size",
+ authors != null ? authors.size() : 0).append(
+ "reviews.size", reviews != null ? reviews.size() : 0)
+ .append("publisher", publisher).toString();
+ }
+
+ public void addAuthor(Author author)
+ {
+ if (authors == null)
+ {
+ authors = new ArrayList();
+ }
+ if (!authors.contains(author))
+ {
+ author.addMedia(this);
+ authors.add(author);
+ }
+ }
+
+ public boolean removeAuthor(Author author)
+ {
+ boolean result = false;
+ if (authors != null)
+ {
+ result = authors.remove(author);
+ if (result) author.removeMedia(this);
+ }
+ return result;
+ }
+
+ public void addReview(Review review)
+ {
+ if (reviews == null)
+ {
+ reviews = new ArrayList();
+ }
+ reviews.add(review);
+ }
+
+ public boolean removeReview(Review review)
+ {
+ if (reviews != null) return reviews.remove(review);
+ else
+ return false;
+ }
+
+ public String getTitle()
+ {
+ return title;
+ }
+
+ public void setTitle(String title)
+ {
+ this.title = title;
+ }
+
+ public Date getPublicationDate()
+ {
+ return publicationDate;
+ }
+
+ public void setPublicationDate(Date publicationDate)
+ {
+ this.publicationDate = publicationDate;
+ }
+
+ public byte[] getCover()
+ {
+ return cover;
+ }
+
+ public void setCover(byte[] cover)
+ {
+ this.cover = cover;
+ }
+
+ public List getAuthors()
+ {
+ return authors;
+ }
+
+ public void setAuthors(List authors)
+ {
+ this.authors = authors;
+ }
+
+ public List getReviews()
+ {
+ return reviews;
+ }
+
+ public void setReviews(List reviews)
+ {
+ this.reviews = reviews;
+ }
+
+ public Publisher getPublisher()
+ {
+ return publisher;
+ }
+
+ public void setPublisher(Publisher publisher)
+ {
+ this.publisher = publisher;
+ }
+
+ public ProductGroup getProductGroup()
+ {
+ return productGroup;
+ }
+
+ public void setProductGroup(ProductGroup productGroup)
+ {
+ this.productGroup = productGroup;
+ }
+}
\ No newline at end of file
Added: db/ojb/trunk/src/xdoclet/sample/java/org/apache/ojb/sample/ProductGroup.java
URL: http://svn.apache.org/viewvc/db/ojb/trunk/src/xdoclet/sample/java/org/apache/ojb/sample/ProductGroup.java?rev=592987&view=auto
==============================================================================
--- db/ojb/trunk/src/xdoclet/sample/java/org/apache/ojb/sample/ProductGroup.java (added)
+++ db/ojb/trunk/src/xdoclet/sample/java/org/apache/ojb/sample/ProductGroup.java Wed Nov 7 17:02:59 2007
@@ -0,0 +1,81 @@
+package org.apache.ojb.sample;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * The ProductGroup class
+ *
+ * @ojb.class
+ * @version $Id$
+ */
+public class ProductGroup extends BasicObject
+{
+ /**
+ * @ojb.field
+ */
+ private String name;
+ /**
+ * @ojb.collection element-class-ref="org.apache.ojb.sample.Medium"
+ * foreignkey="fkProductGroup"
+ * auto-retrieve="true"
+ * auto-update="create"
+ * auto-delete="none"
+ * proxy="true"
+ */
+ private List media;
+
+ public ProductGroup()
+ {
+ }
+
+ public ProductGroup(String name)
+ {
+ this.name = name;
+ }
+
+ public List getMedia()
+ {
+ return media;
+ }
+
+ public void setMedia(List media)
+ {
+ this.media = media;
+ }
+
+ public void addMedium(Medium medium)
+ {
+ if (media == null) media = new ArrayList();
+ if (!media.contains(medium)) media.add(medium);
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+}
\ No newline at end of file
Added: db/ojb/trunk/src/xdoclet/sample/java/org/apache/ojb/sample/Publisher.java
URL: http://svn.apache.org/viewvc/db/ojb/trunk/src/xdoclet/sample/java/org/apache/ojb/sample/Publisher.java?rev=592987&view=auto
==============================================================================
--- db/ojb/trunk/src/xdoclet/sample/java/org/apache/ojb/sample/Publisher.java (added)
+++ db/ojb/trunk/src/xdoclet/sample/java/org/apache/ojb/sample/Publisher.java Wed Nov 7 17:02:59 2007
@@ -0,0 +1,44 @@
+package org.apache.ojb.sample;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * The Publisher interface
+ *
+ * @ojb.class generate-table-info="false"
+ * @version $Id$
+ */
+public interface Publisher extends Serializable
+{
+ public Integer getId();
+
+ public String getName();
+
+ public void setName(String name);
+
+ public List getAuthors();
+
+ public void setAuthors(List authors);
+
+ public void addAuthor(Author author);
+}
Added: db/ojb/trunk/src/xdoclet/sample/java/org/apache/ojb/sample/PublisherImpl.java
URL: http://svn.apache.org/viewvc/db/ojb/trunk/src/xdoclet/sample/java/org/apache/ojb/sample/PublisherImpl.java?rev=592987&view=auto
==============================================================================
--- db/ojb/trunk/src/xdoclet/sample/java/org/apache/ojb/sample/PublisherImpl.java (added)
+++ db/ojb/trunk/src/xdoclet/sample/java/org/apache/ojb/sample/PublisherImpl.java Wed Nov 7 17:02:59 2007
@@ -0,0 +1,85 @@
+package org.apache.ojb.sample;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * The Publisher implementation class
+ *
+ * @ojb.class
+ * @version $Id$
+ */
+public class PublisherImpl extends BasicObject implements Publisher
+{
+ /**
+ * @ojb.field
+ */
+ private String name;
+
+ /**
+ * @ojb.collection element-class-ref="org.apache.ojb.sample.Author"
+ * foreignkey="fkPublisher"
+ * auto-retrieve="true"
+ * auto-update="create"
+ * auto-delete="none"
+ * proxy="true"
+ */
+ private List authors;
+
+ public PublisherImpl()
+ {
+ }
+
+ public PublisherImpl(String name)
+ {
+ this.name = name;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
+ public List getAuthors()
+ {
+ return authors;
+ }
+
+ public void setAuthors(List authors)
+ {
+ this.authors = authors;
+ }
+
+ public void addAuthor(Author author)
+ {
+ if (authors == null)
+ {
+ authors = new ArrayList();
+ }
+ if (!authors.contains(author)) authors.add(author);
+ }
+}
Added: db/ojb/trunk/src/xdoclet/sample/java/org/apache/ojb/sample/Review.java
URL: http://svn.apache.org/viewvc/db/ojb/trunk/src/xdoclet/sample/java/org/apache/ojb/sample/Review.java?rev=592987&view=auto
==============================================================================
--- db/ojb/trunk/src/xdoclet/sample/java/org/apache/ojb/sample/Review.java (added)
+++ db/ojb/trunk/src/xdoclet/sample/java/org/apache/ojb/sample/Review.java Wed Nov 7 17:02:59 2007
@@ -0,0 +1,154 @@
+package org.apache.ojb.sample;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.commons.lang.builder.EqualsBuilder;
+import org.apache.commons.lang.builder.ToStringBuilder;
+import org.apache.commons.lang.builder.ToStringStyle;
+
+/**
+ * The Review class
+ *
+ * @ojb.class
+ * @ojb.field name="fkAuthor" jdbc-type="INTEGER"
+ * @version $Id$
+ */
+public class Review extends BasicObject
+{
+ /**
+ * @ojb.field
+ */
+ private Integer vote;
+ /**
+ * @ojb.field
+ */
+ private String summary;
+ // This field is used by a 1:1 and target of an 1:n reference in class Medium
+ // so it's not recommended to use an "anonymous field". But we can declare it as
+ // private field without getter/setter with a specific PersistentField implementation
+ // class called 'direct' (the OJB shortcut name)
+ /**
+ * @ojb.field field-class="direct"
+ */
+ private Integer fkMedium;
+
+ /**
+ * @ojb.reference foreignkey="fkAuthor" auto-retrieve="true"
+ * auto-update="create" auto-delete="none" proxy="true"
+ */
+ private Author author;
+ /**
+ * @ojb.reference foreignkey="fkMedium" auto-retrieve="true"
+ * auto-update="create" auto-delete="none" proxy="true"
+ */
+ private Medium medium;
+
+ public Review()
+ {
+ }
+
+ public Review(String summary, Integer vote, Medium medium)
+ {
+ this.summary = summary;
+ this.vote = vote;
+ this.medium = medium;
+ }
+
+ public Review(String summary, Integer vote)
+ {
+ this.summary = summary;
+ this.vote = vote;
+ }
+
+ public Review(String summary)
+ {
+ this.summary = summary;
+ }
+
+ public Integer getVote()
+ {
+ return vote;
+ }
+
+ public void setVote(Integer vote)
+ {
+ this.vote = vote;
+ }
+
+ public Integer getFkMedium()
+ {
+ return fkMedium;
+ }
+
+ public void setFkMedium(Integer fkMedium)
+ {
+ this.fkMedium = fkMedium;
+ }
+
+ public String getSummary()
+ {
+ return summary;
+ }
+
+ public void setSummary(String summary)
+ {
+ this.summary = summary;
+ }
+
+ public Author getAuthor()
+ {
+ return author;
+ }
+
+ public void setAuthor(Author author)
+ {
+ this.author = author;
+ }
+
+ public Medium getMedium()
+ {
+ return medium;
+ }
+
+ public void setMedium(Medium medium)
+ {
+ this.medium = medium;
+ }
+
+ public boolean equals(Object obj)
+ {
+ boolean result = false;
+ if (obj instanceof Review)
+ {
+ Review other = (Review) obj;
+ result = new EqualsBuilder().append(id, other.id).append(summary,
+ other.summary).append(version, other.version).append(
+ fkMedium, other.fkMedium).append(author, other.author)
+ .isEquals();
+ }
+ return result;
+ }
+
+ public String toString()
+ {
+ return ToStringBuilder.reflectionToString(this,
+ ToStringStyle.MULTI_LINE_STYLE, false);
+ }
+}