I have again edited the repository as well as the model template files. Now 
it supports also the dynamic proxy pattern from ojb.



At 11:21 27.09.2002 +0200, you wrote:
>Oh, there is another Method as well. We have to implement a method (which 
>is already done for torque.-properties) which deletes the ojb. in front of 
>the properties, then the .-thing is working.
>
>At 13:26 25.09.2002 -0500, you wrote:
>>For some reason, I feel I'm treading lightly here, but won't ${ojb.xxx}
>>work?
>>
>>- Stephen
>>
>> > -----Original Message-----
>> > From: Markus M. May [mailto:[EMAIL PROTECTED]]
>> > Sent: Wednesday, September 25, 2002 12:40 PM
>> > To: Turbine Torque Developers List
>> > Subject: RE: [patch] ojb templates
>> >
>> > I have tried to use the ojb.xxx stuff, but it does not work at least
>>on my
>> > machine. It seems, that Velocity tries to retrieve the value ojb.xxx
>>with a
>> > getter method from an ojb object. And this is not available, I
>>believe.
>> >
>>
>>
>>--
>>To unsubscribe, 
>>e-mail:   <mailto:[EMAIL PROTECTED]>
>>For additional commands, e-mail: 
>><mailto:[EMAIL PROTECTED]>
>
>---+++--------------------+++---------------------+++---
>Markus M. May
>[EMAIL PROTECTED]
>
>Provide you with free J2EE projects
>
>Please use my public key at:
>http://www.javafreedom.org/mmay_javafreedom_org.key
>---+++--------------------+++---------------------+++---
>
>
>--
>To unsubscribe, 
>e-mail:   <mailto:[EMAIL PROTECTED]>
>For additional commands, e-mail: 
><mailto:[EMAIL PROTECTED]>
>

---+++--------------------+++---------------------+++---
Markus M. May
[EMAIL PROTECTED]

Provide you with free J2EE projects

Please use my public key at:
http://www.javafreedom.org/mmay_javafreedom_org.key
---+++--------------------+++---------------------+++---
Index: Control.vm
===================================================================
RCS file: 
/home/cvspublic/jakarta-turbine-torque/src/templates/ojb/repository/Control.vm,v
retrieving revision 1.3
diff -u -r1.3 Control.vm
--- Control.vm  16 Apr 2002 07:51:18 -0000      1.3
+++ Control.vm  27 Sep 2002 09:14:17 -0000
@@ -1,6 +1,12 @@
 #set ( $basepath = $generator.OutputPath)
 
-$generator.parse("ojb/repository/MainRepository.vm","repository.xml","dataModels",$dataModels)
+#foreach ($dataModel in $dataModels)
+
+#if($velocityCount==1)
+$generator.parse("ojb/repository/MainRepository.vm","repository.xml","dataModel",$dataModel)
+#end
+
+#end
 
 #foreach ($dataModel in $dataModels)
   #set ( $outFile = "repository_${dataModel.shortName}.xml" )
Index: MainRepository.vm
===================================================================
RCS file: 
/home/cvspublic/jakarta-turbine-torque/src/templates/ojb/repository/MainRepository.vm,v
retrieving revision 1.3
diff -u -r1.3 MainRepository.vm
--- MainRepository.vm   3 Jul 2002 01:08:44 -0000       1.3
+++ MainRepository.vm   27 Sep 2002 09:14:17 -0000
@@ -1,5 +1,3 @@
-#set ( $database = $dataModel.database )
-
 <?xml version="1.0" encoding="UTF-8"?>
 
 <!-- defining entities for include-files -->
@@ -15,10 +13,10 @@
      the Connection specified here will be used. -->
 
   <jdbc-connection-descriptor id="default"
-    platform="${ojb.platform}"
+    platform="${ojbPlatform}"
     jdbc-level="${jdbcLevel}"
-  #if (${ojb.useJNDI} == "true")
-    jndi-datasource-name="${ojb.JNDISource}"
+  #if ($ojbUseJNDI == true)
+    jndi-datasource-name="${ojbJNDISource}"
   #else
     driver="${databaseDriver}"
     protocol="jdbc"
Index: Control.vm
===================================================================
RCS file: 
/home/cvspublic/jakarta-turbine-torque/src/templates/ojb/repository/Control.vm,v
retrieving revision 1.3
diff -u -r1.3 Control.vm
--- Control.vm  16 Apr 2002 07:51:18 -0000      1.3
+++ Control.vm  27 Sep 2002 11:04:09 -0000
@@ -1,12 +1,16 @@
 #set ( $basepath = $generator.OutputPath)
 
-$generator.parse("ojb/repository/MainRepository.vm","repository.xml","dataModels",$dataModels)
+#foreach ($dataModel in $dataModels)
+    #if($velocityCount==1)
+        
+$generator.parse("ojb/repository/MainRepository.vm","repository.xml","dataModel",$dataModel)
+    #end
+#end
 
 #foreach ($dataModel in $dataModels)
   #set ( $outFile = "repository_${dataModel.shortName}.xml" )
   #set ( $modelCount = $velocityCount )
   
-  File to be created: $outFile
+  File to be created: $outFile, $dataModel
   $generator.parse("ojb/repository/Repository.vm",$outFile,"dataModel",$dataModel)
  
 #end
Index: MainRepository.vm
===================================================================
RCS file: 
/home/cvspublic/jakarta-turbine-torque/src/templates/ojb/repository/MainRepository.vm,v
retrieving revision 1.3
diff -u -r1.3 MainRepository.vm
--- MainRepository.vm   3 Jul 2002 01:08:44 -0000       1.3
+++ MainRepository.vm   27 Sep 2002 11:04:09 -0000
@@ -1,5 +1,3 @@
-#set ( $database = $dataModel.database )
-
 <?xml version="1.0" encoding="UTF-8"?>
 
 <!-- defining entities for include-files -->
@@ -15,10 +13,10 @@
      the Connection specified here will be used. -->
 
   <jdbc-connection-descriptor id="default"
-    platform="${ojb.platform}"
+    platform="${ojbPlatform}"
     jdbc-level="${jdbcLevel}"
-  #if (${ojb.useJNDI} == "true")
-    jndi-datasource-name="${ojb.JNDISource}"
+  #if ($ojbUseJNDI == true)
+    jndi-datasource-name="${ojbJNDISource}"
   #else
     driver="${databaseDriver}"
     protocol="jdbc"
Index: Repository.vm
===================================================================
RCS file: 
/home/cvspublic/jakarta-turbine-torque/src/templates/ojb/repository/Repository.vm,v
retrieving revision 1.4
diff -u -r1.4 Repository.vm
--- Repository.vm       3 Jul 2002 01:08:44 -0000       1.4
+++ Repository.vm       27 Sep 2002 11:04:09 -0000
@@ -19,7 +19,10 @@
 ============================================================== 
 $!table.getDescription()
 -->
-  <class-descriptor proxy="dynamic"
+  <class-descriptor 
+    #if ( $ojbUseProxy == true)
+       proxy="dynamic"
+    #end       
     class="${package}.${table.JavaName}"
     table="$table.Name"
   >
@@ -84,7 +87,9 @@
 #end
 #if ($col.isAutoIncrement()) ${space}autoincrement="true" 
 #end
-#if ($size != "") ${space}length="${size}" 
+#if ($size != "" || $size != "0") 
+  ${space}length="${size}"
+  #set ($size = "0")
 #end
 #if ($precision != "") ${space}precision="${precision}" 
 #end
Index: Control.vm
===================================================================
RCS file: /home/cvspublic/jakarta-turbine-torque/src/templates/ojb/model/Control.vm,v
retrieving revision 1.1
diff -u -r1.1 Control.vm
--- Control.vm  11 Apr 2002 17:10:40 -0000      1.1
+++ Control.vm  27 Sep 2002 11:04:21 -0000
@@ -15,10 +15,23 @@
     #foreach ($tbl in $database.Tables)
       $tbl.Name
       #set ( $firstcap=$tbl.JavaName )
+      
       #set ( $fname = "${firstcap}.java" )
       #set ( $path = "${strings.getPackageAsPath($package)}$fname" )
       $generator.parse("ojb/model/Object.vm",$path,"table",$tbl)
+
+      #set ( $iname = "${firstcap}Interface.java" )
+      #set ( $path = "${strings.getPackageAsPath($package)}$iname" )
+      $generator.parse("ojb/model/Interface.vm",$path,"table",$tbl)
+      
+      #if ( $ojbUseProxy == true )
+            
+       #set ( $piname = "${firstcap}ProxyInterface.java" )
+               #set ( $path = "${strings.getPackageAsPath($package)}$piname" )
+       $generator.parse("ojb/model/ProxyInterface.vm",$path,"table",$tbl)
+      
+      #end     
     #end
   #end
 
-#end
+#end
\ No newline at end of file
Index: Object.vm
===================================================================
RCS file: /home/cvspublic/jakarta-turbine-torque/src/templates/ojb/model/Object.vm,v
retrieving revision 1.5
diff -u -r1.5 Object.vm
--- Object.vm   23 Sep 2002 09:12:48 -0000      1.5
+++ Object.vm   27 Sep 2002 11:04:21 -0000
@@ -6,25 +6,29 @@
 #end
 package ${package};
 
-#if ($table.BaseClass == "")
-    #set ($extendsBaseClass = "" )
-#else
+#if ($table.BaseClass)
     #set ($extendsBaseClass = "extends $table.BaseClass" )
+#else
+    #set ($extendsBaseClass = "" )
 #end
 
-#if ($table.Interface == "")
-    #set ($interface = "Serializable" )
+#if ($table.Interface)
+    #set ($interface = "Serializable, ${table.JavaName}Interface, $table.Interface" )
 #else
-    #set ($interface = "Serializable, $table.Interface" )
+    #set ($interface = "Serializable, ${table.JavaName}Interface" )
 #end
 
 import java.io.Serializable;
 import java.util.Date;
 
-/**
- * $table.Name
+
+/** 
+#if ($addTimeStamp)
+ * This class was autogenerated by Torque on:
  *
  * [$now]
+ *
+#end
  */
 public class $table.JavaName $extendsBaseClass
         implements $interface
@@ -39,7 +43,7 @@
       #elseif ($cjtype == "int")
         #set ( $defaultValue = "0" )
       #end
-    protected $cjtype $clo = $defaultValue;
+    private $cjtype $clo = $defaultValue;
     #end
 
     #foreach ($col in $table.Columns)
#set ($db = $table.Database)
#if ($db.Package)
    #set ($package = $db.Package)
#else
    #set ($package = $targetPackage)
#end
package ${package};

import java.io.Serializable;
import java.util.Date;

/** 
#if ($addTimeStamp)
 * This interface was autogenerated by Torque on:
 *
 * [$now]
 *
#end
 */
public interface ${table.JavaName}Interface extends Serializable
{

    #foreach ($col in $table.Columns)
        #set ( $cfc=$col.JavaName )
        #set ( $cfc=$cfc.replaceFirst(".", $cfc.substring(0,1).toUpperCase()) )
        #set ( $clo=$col.Name.toLowerCase() )
        #set ( $cjtype = $col.JavaPrimitive )

     /**
      * Get the $cfc
      * @return $cjtype
      */
     public $cjtype get${cfc}();
 
     /**
      * Set the value of $cfc
      */
     public void set${cfc}($cjtype v );
 
     #end
}
#set ($db = $table.Database)
#if ($db.Package)
    #set ($package = $db.Package)
#else
    #set ($package = $targetPackage)
#end
package ${package};

import java.io.Serializable;
import java.util.Date;

/** 
#if ($addTimeStamp)
 * This interface was autogenerated by Torque on:
 *
 * [$now]
 *
#end
 */
public interface ${table.JavaName}ProxyInterface extends Serializable
{

    #foreach ($col in $table.PrimaryKey)
        #set ( $cfc=$col.JavaName )
        #set ( $cfc=$cfc.replaceFirst(".", $cfc.substring(0,1).toUpperCase()) )
        #set ( $clo=$col.Name.toLowerCase() )
        #set ( $cjtype = $col.JavaPrimitive )

    /**
     * Get the $cfc
     * @return $cjtype
     */
    public $cjtype get${cfc}();

    #end
}

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to