Table Mapping
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class
name="com.promainsur.sigepweb.model.Provincia"
table="provincias"
select-before-update="false"
dynamic-update="false"
dynamic-insert="false"
optimistic-lock="version"
>
<id
name="idprovincia"
column="idProvincia"
type="java.lang.Long"
>
<generator class="increment">
</generator>
</id>
<property
name="nombre"
type="java.lang.String"
update="true"
insert="true"
access="property"
column="nombre"
length="50"
not-null="true"
unique="false"
/>
<!-- imported bi-directional many-to-one association to Pais -->
<many-to-one
name="Pais"
class="com.promainsur.sigepweb.model.Pais"
not-null="false"
update="true"
insert="true"
outer-join="auto"
>
<column name="idPais" />
</many-to-one>
<!-- imported bi-directional many-to-one association to Matriz -->
<many-to-one
name="Matriz"
class="com.promainsur.sigepweb.model.Matriz"
not-null="false"
update="true"
insert="true"
outer-join="auto"
>
<column name="idMatriz" />
</many-to-one>
</class>
</hibernate-mapping>
*************************************************************************************************************************
The Table Class
package com.promainsur.sigepweb.model;
/*
* Created on Tue Sep 12 21:14:02 CEST 2006
*
*/
import java.io.Serializable;
import com.promainsur.sigepweb.model.Provincia;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.EqualsBuilder;
/**
* Provincias Base Java Bean
*
* This class is the base class for the model
*
* <p>
* <a href="Provincia.java.html"><i>View Source</i></a>
* </p>
*
*/
public class Provincia extends com.promainsur.sigepweb.model.BaseObject implements Serializable {
protected Long idprovincia;
protected String nombre;
protected com.promainsur.sigepweb.model.Pais pais;
protected com.promainsur.sigepweb.model.Matriz matriz;
protected java.util.Set escrituraList = new java.util.HashSet();
protected java.util.Set localidadList = new java.util.HashSet();
/**
*
* Default Empty Constructor for class Provincias
*
*/
public Provincia () {
super();
}
/**
*
* Default All Fields Constructor for class Provincias
*
*/
public Provincia (
Long in_idprovincia
,String in_idmatriz
,Long in_idpais
,String in_nombre
) {
this.setIdprovincia(in_idprovincia);
this.setIdmatriz(in_idmatriz);
this.setIdpais(in_idpais);
this.setNombre(in_nombre);
}
public com.promainsur.sigepweb.model.Pais getPais () {
// instantiate a new association entity if it is null
if (pais == null) {
pais = new com.promainsur.sigepweb.model.Pais ();
}
return pais;
}
public void setPais (com.promainsur.sigepweb.model.Pais in_pais) {
this.pais = in_pais;
}
public com.promainsur.sigepweb.model.Matriz getMatriz () {
// instantiate a new association entity if it is null
if (matriz == null) {
matriz = new com.promainsur.sigepweb.model.Matriz ();
}
return matriz;
}
public void setMatriz (com.promainsur.sigepweb.model.Matriz in_matriz) {
this.matriz = in_matriz;
}
public java.util.Set getEscrituraList () {
return escrituraList;
}
public void setEscrituraList (java.util.Set in_escrituraList) {
this.escrituraList = in_escrituraList;
}
public java.util.Set getLocalidadList () {
return localidadList;
}
public void setLocalidadList (java.util.Set in_localidadList) {
this.localidadList = in_localidadList;
}
/**
*
* @return Long
*/
public Long getIdprovincia() {
return this.idprovincia;
}
/**
* Set the idprovincia
*/
public void setIdprovincia(Long aValue) {
this.idprovincia = aValue;
}
/**
*
* @return String
*/
public String getIdmatriz() {
return this.getMatriz().getIdmatriz();
}
/**
* Set the idmatriz
*/
public void setIdmatriz(String aValue) {
this.getMatriz().setIdmatriz(aValue);
}
/**
*
* @return Long
*/
public Long getIdpais() {
return this.getPais().getIdpais();
}
/**
* Set the idpais
*/
public void setIdpais(Long aValue) {
this.getPais().setIdpais(aValue);
}
/**
*
* @return String
*/
public String getNombre() {
return this.nombre;
}
/**
* Set the nombre
*/
public void setNombre(String aValue) {
this.nombre = aValue;
}
/**
* @see java.lang.Object#equals(Object)
*/
public boolean equals(Object object) {
if (!(object instanceof Provincia)) {
return false;
}
Provincia rhs = (Provincia) object;
return new EqualsBuilder()
.append(this.idprovincia, rhs.idprovincia)
.append(this.nombre, rhs.nombre)
.isEquals();
}
/**
* @see java.lang.Object#hashCode()
*/
public int hashCode() {
return new HashCodeBuilder(-82280557, -700257973)
.append(this.idprovincia)
.append(this.nombre)
.toHashCode();
}
/**
* @see java.lang.Object#toString()
*/
public String toString() {
return new ToStringBuilder(this)
.append("idprovincia", this.idprovincia)
.append("nombre", this.nombre)
.toString();
}
/**
* Return the name of the first key column
*/
public String getFirstKeyColumnName() {
return "idprovincia";
}
}
|