All Downloads are FREE. Search and download functionalities are using the official Maven repository.

.mardao-maven-plugin.3.0.5.source-code.GeneratedDaoImpl.vm Maven / Gradle / Ivy

There is a newer version: 3.0.13
Show newest version
package ${daoBasePackage};

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.TreeMap;
import org.xml.sax.ContentHandler;
import org.xml.sax.SAXException;
import net.sf.mardao.core.CursorPage;
import net.sf.mardao.core.filter.Filter;
import net.sf.mardao.core.geo.DLocation;
import net.sf.mardao.dao.AbstractDao;
import net.sf.mardao.dao.Supplier;
import ${entity.className};
#foreach( $field in $entity.oneToOnes )
import ${field.entity.className};
#end
#foreach( $field in $entity.manyToOnes )
import ${field.entity.className};
#end
#foreach( $field in $entity.manyToManys )	 
import ${field.entity.className};
#end

/**
 * The ${entity.simpleName} domain-object specific finders and methods go in this POJO.
 * 
 * Generated on ${currentDate}.
 * @author mardao DAO generator (${helper.class.name})
 */
public class Generated${entity.simpleName}DaoImpl
  extends AbstractDao<${entity.simpleName}, ${entity.pk.type}> {

  public Generated${entity.simpleName}DaoImpl(Supplier supplier) {
    super(new ${entity.simpleName}Mapper(supplier), supplier);
  }

// ----------------------- field finders -------------------------------
#foreach( $field in $entity.fields )
#if( $field.type == 'java.util.Collection' )
#set( $fieldType = 'java.lang.Object' )
#else
#set( $fieldType = $field.type )
#end
#if( $entity.isUnique($field.name) )
  /**
   * find-by method for unique field ${field.name}
   * @param ${field.name} the unique attribute
   * @return the unique ${entity.simpleName} for the specified ${field.name}
   */
#if( $entity.parent )
  public ${entity.simpleName} findBy${field.nameFirst}(Object ${entity.parent.name}, ${fieldType} ${field.name}) {
    return queryUniqueByField(${entity.parent.name}, ${entity.simpleName}Mapper.Field.${field.nameUpper}.getFieldName(), ${field.name});
#else
  public ${entity.simpleName} findBy${field.nameFirst}(${fieldType} ${field.name}) {
    return queryUniqueByField(null, ${entity.simpleName}Mapper.Field.${field.nameUpper}.getFieldName(), ${field.name});
#end
  }

##/**
##* find-key-by method for unique attribute field ${field.name}
##* @param ${field.name} the unique attribute
##* @return the unique ${entity.simpleName} for the specified attribute
##*/
##  ${entity.pk.type} findKeyBy${helper.firstToUpper($field.name)}(${fieldType} ${field.name});
#else
  /**
   * query-by method for field ${field.name}
   * @param ${field.name} the specified attribute
   * @return an Iterable of ${entity.simpleName}s for the specified ${field.name}
   */
#if( $entity.parent )
  public Iterable<${entity.simpleName}> queryBy${field.nameFirst}(Object ${entity.parent.name}, ${fieldType} ${field.name}) {
    return queryByField(${entity.parent.name}, ${entity.simpleName}Mapper.Field.${field.nameUpper}.getFieldName(), ${field.name});
#else
  public Iterable<${entity.simpleName}> queryBy${field.nameFirst}(${fieldType} ${field.name}) {
    return queryByField(null, ${entity.simpleName}Mapper.Field.${field.nameUpper}.getFieldName(), ${field.name});
#end
  }

#end
#end

// ----------------------- query methods -------------------------------


}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy