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

pire-db.empire-db-codegen.3.2.0.source-code.Record.vm Maven / Gradle / Ivy

The newest version!
#*
 * 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.
 *#
package ${recordPackageName};

#if ($parser.hasBigDecimalField($table))
import java.math.BigDecimal;
#end

#if ($parser.hasDateField($table))
import java.util.Date;
#end

import org.apache.empire.db.DBContext;
import ${basePackageName}.${dbClassName};
import ${recordPackageName}.${baseRecordClassName};
import ${tablePackageName}.$parser.getTableClassName($table.name);

/**
 * Auto-generated class that represents one record (or row) of data from a
 * database table.  One of these is generated for each table or view in the
 * database.  The interface defines getters for auto-generated data (e.g. 
 * primary key, time stamp field for optimistic locking).  It generates both
 * getter and setter method for all other columns in the table, with the 
 * exception of foreign key references.
 *
 * This class provides protected method that subclasses should use to provide
 * access to related records.
 */
public class $parser.getRecordClassName($table.name) extends ${baseRecordClassName}<$contextClassName, $parser.getTableClassName($table.name)> {

	private static final long serialVersionUID = 1L;

	public $parser.getRecordClassName($table.name)(DBContext context) {
		super(context, ${dbClassName}.get().$parser.getTableName($table));
	}
	
#if($createRecordProperties == true)
	// Access methods for all columns
#foreach($col in $table.columns)

	public $parser.getJavaType($col).getSimpleName() $parser.getAccessorName($col)() {
		return ($parser.getJavaType($col).getSimpleName())super.get(T.${parser.getColumnName($col)});
	}
	public void $parser.getMutatorName($col)($parser.getJavaType($col).getSimpleName() val) {
		super.set(T.${parser.getColumnName($col)}, val);
	}
#end
#end


}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy