db-torque-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mpoes...@apache.org
Subject cvs commit: db-torque/src/generator/src/templates/ojb/model Manager.vm BaseManager.vm
Date Thu, 11 Sep 2003 16:46:49 GMT
mpoeschl    2003/09/11 09:46:49

  Modified:    src/generator/src/templates/ojb/model Manager.vm
                        BaseManager.vm
  Log:
  Manager should extend BaseManager ;-)
  add getObjectByPk()
  
  Revision  Changes    Path
  1.2       +1 -1      db-torque/src/generator/src/templates/ojb/model/Manager.vm
  
  Index: Manager.vm
  ===================================================================
  RCS file: /home/cvs/db-torque/src/generator/src/templates/ojb/model/Manager.vm,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Manager.vm	11 Sep 2003 06:42:13 -0000	1.1
  +++ Manager.vm	11 Sep 2003 16:46:42 -0000	1.2
  @@ -16,7 +16,7 @@
    * application requirements.  This class will only be generated as
    * long as it does not already exist in the output directory.
    */
  -public class ${table.JavaName}Manager extends $basePrefix$table.JavaName
  +public class ${table.JavaName}Manager extends ${basePrefix}${table.JavaName}Manager
   {
       /** singleton instance */
       private static ${table.JavaName}Manager singleton;
  
  
  
  1.2       +13 -0     db-torque/src/generator/src/templates/ojb/model/BaseManager.vm
  
  Index: BaseManager.vm
  ===================================================================
  RCS file: /home/cvs/db-torque/src/generator/src/templates/ojb/model/BaseManager.vm,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- BaseManager.vm	11 Sep 2003 06:42:13 -0000	1.1
  +++ BaseManager.vm	11 Sep 2003 16:46:42 -0000	1.2
  @@ -34,6 +34,19 @@
           return object;
       }
   
  +#set ($params = "")
  +#foreach ($pk in $table.PrimaryKey)
  +  #set ($params = "$params ${pk.JavaNative} ${pk.uncapitalisedJavaName}, ")
  +#end
  +    public ${table.JavaName} getObjectByPk($strings.chop($params,2))
  +    {
  +        Criteria crit = new Criteria();
  +#foreach ($pk in $table.PrimaryKey)
  +        crit.addEqualTo("${pk.uncapitalisedJavaName}", ${pk.uncapitalisedJavaName});
  +#end
  +        return (${table.JavaName}) getObjectByCriteria(crit);
  +    }
  +
       protected Collection getCollectionByCriteria(Criteria crit) {
           PersistenceBroker broker = getBroker();
           Query query = new QueryByCriteria(${table.JavaName}.class, crit);
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
For additional commands, e-mail: torque-dev-help@db.apache.org


Mime
View raw message