I have updated to class to the following, adding your suggested not-null=true tags.
package au.edu.tlf.crisp2.model;
import java.util.HashSet;
import java.util.Set;
import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;
/**
* <p>
* Intellectual Property is an artifact or piece of knowledge that is to be used
* within a project. It will have a licence (and associated usage rights) associated with it.
* <p>
*
* </p>
* This class is used to generate the Spring validation rules
* as well as the Hibernate mapping file.
* </p>
*
* <p>
* <a href="IntellectualProperty.java.html"><i>View Source</i></a>
* </p>
*
* @author <a href="mailto:
[email protected]">Manpreet Minhas</a>
*
* @hibernate.class
* table="intellectual_property"
*/
public class IntellectualProperty extends BaseObject {
// Attributes =============================================================
private Long id;
private String title;
private String description;
private String acknowledgementNotes;
private String notes;
private String externalSystemID;
// Associations ===========================================================
public Set contentTypes = new HashSet(); // of type ContentType
public Long copyrightStatus;
public Set catalogs = new HashSet(); // of type Catalog
public Set storages = new HashSet(); // of type Storage
public Set contributors = new HashSet(); // of type Contributor
public Set licences = new HashSet(); // of type Licence
public Set usages = new HashSet(); // of type Use
public Set parents = new HashSet(); // of type IntellectualProperty parent element
public Set children = new HashSet(); // of type IntellectualProperty child elements
public Status status;
// Methods ================================================================
/**
* <p>
* Returns the unique identifier of the intellectual property. The
* identifier is unique only within the application instance.
* </p>
*
* @return Long
*
* @hibernate.id
* column="id"
* generator-class="native"
* unsaved-value="null"
*/
public Long getId() {
return id;
}
/**
* <p>
* Lists an id for the intellectual property. This method would not normally
* be called as the unique id would be set during creation of the record.
* </p>
*
* @param id The id to set.
*/
public void setId(Long id) {
this.id = id;
}
/**
* <p>
* Get the title
* </p>
*
* @return Returns the title.
*
* @hibernate.property
* column="title"
* type="text"
*/
public String getTitle() {
return title;
}
/**
* <p>
* Set the title
* </p>
* @spring.validator
* type="required"
* msgkey="intellectualProperty.title.required"
*
* @param title The title to set.
*/
public void setTitle(String title) {
this.title = title;
}
/**
* <p>
* Get the description
* </p>
*
* @return Returns the description.
*
* @hibernate.property
* column="description"
* type="text"
*/
public String getDescription() {
return description;
}
/**
* <p>
* Set the description
* </p>
*
* @param description The description to set.
*/
public void setDescription(String description) {
this.description = description;
}
/**
* @return Returns the acknowledgementNotes.
*
* @hibernate.property
* column="ack_notes"
* type="text"
*/
public String getAcknowledgementNotes() {
return acknowledgementNotes;
}
/**
* @param acknowledgementNotes The acknowledgementNotes to set.
*/
public void setAcknowledgementNotes(String acknowledgementNotes) {
this.acknowledgementNotes = acknowledgementNotes;
}
/**
* @return Returns the notes.
* @hibernate.property
* column="notes"
* type="text"
*/
public String getNotes() {
return notes;
}
/**
* @param notes The notes to set.
*/
public void setNotes(String notes) {
this.notes = notes;
}
/**
* @return Returns the contentType.
*
* @hibernate.set
* name="contentTypes"
* cascade="all"
* lazy="true"
* not-null="true"
*
* @hibernate.collection-key
* column="ip_content_type_id"
*
* @hibernate.collection-one-to-many
* class="au.edu.tlf.crisp2.model.ContentType"
*/
public Set getContentTypes() {
return contentTypes;
}
/**
* @param contentType The contentType to set.
*/
public void setContentTypes(Set contentTypes) {
this.contentTypes = contentTypes;
}
/**
* @return Returns the copyrightStatus.
*
* @hibernate.property
* column="copyright_status"
*/
public Long getCopyrightStatus() {
return copyrightStatus;
}
/**
* @spring.validator
* type="required"
* msgkey="intellectualProperty.copyrightStatus.required"
*
* @param copyrightStatus The copyrightStatus to set.
*/
public void setCopyrightStatus(Long copyrightStatus) {
this.copyrightStatus = copyrightStatus;
}
/**
* @return Returns the status.
* @hibernate.many-to-one
* column="fk_status_intellectual_property_id"
*/
public Status getStatus() {
return status;
}
/**
* @param status The status to set.
*/
public void setStatus(Status status) {
this.status = status;
}
/**
* <p>
* Returns a list of catalog numbers
* </p>
*
* @return Returns the catalogNumberList.
*
* @hibernate.set
* name="catalogs"
* cascade="all"
* lazy="true"
* not-null="true"
*
* @hibernate.collection-key
* column="ip_catalog_id"
*
* @hibernate.collection-one-to-many
* class="au.edu.tlf.crisp2.model.Catalog"
*/
public Set getCatalogs() {
return catalogs;
}
/**
* <p>
* Set the catalogue entries
* </p>
*
* @param catalogueNumberList The catalogueNumberList to set.
*/
public void setCatalogs(Set catalogNumbers) {
this.catalogs = catalogNumbers;
}
/**
* <p>
* Returns a list of catalog numbers
* </p>
*
* @return Returns the storages.
*
* @hibernate.set
* name="storages"
* cascade="all"
* lazy="true"
* not-null="true"
*
* @hibernate.collection-key
* column="ip_storage_id"
* @hibernate.collection-one-to-many
* class="au.edu.tlf.crisp2.model.Storage"
*/
public Set getStorages() {
return storages;
}
/**
* <p>
* Set the storage locations
* </p>
*
* @param storages The storages to set.
*/
public void setStorages(Set storages) {
this.storages = storages;
}
/**
* <p>
* Get the storage locations
* </p>
*
* @return Returns the contributors.
*
* @hibernate.set
* cascade="all"
* lazy="true"
* not-null="true"
*
* @hibernate.collection-key
* column="ip_contributor_id"
* @hibernate.collection-one-to-many
* class="au.edu.tlf.crisp2.model.Contributor"
*/
public Set getContributors() {
return contributors;
}
/**
* <p>
* Get the contributors
* </p>
*
* @param contributors The contributors to set.
*/
public void setContributors(Set contributors) {
this.contributors = contributors;
}
/**
* <p>
* Associate licences to intellectual property
* </p>
*
* @return Returns the licences.
*
* @hibernate.set
* table="table_ip_licence"
* lazy="true"
* cascade="save-update
* not-null="true"
*
* @hibernate.collection-key
* column="fk_ip_id"
*
* @hibernate.collection-many-to-many
* class="au.edu.tlf.crisp2.model.Licence"
* column="fk_licence_id"
*/
public Set getLicences() {
return licences;
}
/**
* <p>
* Set the licences
* </p>
*
* @param licences The licences to set.
*/
public void setLicences(Set licences) {
this.licences = licences;
}
/**
* <p>
* Returns a list of catalog numbers
* </p>
*
* @return Returns the catalogNumberList.
*
* @hibernate.set
* name="usages"
* cascade="all"
* lazy="true"
* not-null="true"
*
* @hibernate.collection-key
* column="ip_usage_id"
*
* @hibernate.collection-one-to-many
* class="au.edu.tlf.crisp2.model.IntellectualPropertyUsage"
*/
public Set getUsages() {
return usages;
}
/**
* <p>
* Set to usage
* </p>
*
* @param usages The usages list to set.
*/
public void setUsages(Set usages) {
this.usages = usages;
}
/**
* @return Returns the parent intellectualProperties.
*
* @hibernate.set
* name="table_intellectual_property_composite"
* cascade="save-update"
* lazy="true"
* not-null="true"
*
* @hibernate.collection-key
* column="parent_id"
*
* @hibernate.collection-many-to-many
* class="au.edu.tlf.crisp2.model.IntellectualProperty"
* column="child_id"
*/
public Set getParents() {
return parents;
}
/**
* @param intellectualProperties The intellectualProperties to set.
*/
public void setParents(Set parents) {
this.parents = parents;
}
/**
* @return Returns the children.
*
* @hibernate.set
* table="table_intellectual_property_composite"
* cascade="save-update"
* lazy="true"
* not-null="true"
*
* @hibernate.collection-key
* column="child_id"
*
* @hibernate.collection-many-to-many
* class="au.edu.tlf.crisp2.model.IntellectualProperty"
* column="parent_id"
*/
public Set getChildren() {
return children;
}
/**
* @param children The children to set.
*/
public void setChildren(Set children) {
this.children = children;
}
/**
* @return Returns the externalSystemID.
* @hibernate.property
* column="external_system_id"
*/
public String getExternalSystemID() {
return externalSystemID;
}
/**
* @param externalSystemID The externalSystemID to set.
*/
public void setExternalSystemID(String externalSystemID) {
this.externalSystemID = externalSystemID;
}
/**
* @see java.lang.Object#equals(Object)
*/
public boolean equals(Object object) {
if (!(object instanceof IntellectualProperty)) {
return false;
}
IntellectualProperty rhs = (IntellectualProperty) object;
return new EqualsBuilder()
.append(this.title,rhs.title)
.append(this.notes, rhs.notes)
.append(this.acknowledgementNotes, rhs.acknowledgementNotes)
.append(this.description, rhs.description)
.append(this.copyrightStatus,rhs.copyrightStatus)
.append(this.status,rhs.status)
.append(this.id,rhs.id)
.isEquals();
}
/**
* @see java.lang.Object#hashCode()
*/
public int hashCode() {
return new HashCodeBuilder(489588187, -1864837411)
.append(this.title)
.append(this.notes)
.append(this.acknowledgementNotes)
.append(this.description)
.append(this.copyrightStatus)
.append(this.status)
.append(this.id)
.toHashCode();
}
/**
* @see java.lang.Object#toString()
*/
public String toString() {
return new ToStringBuilder(this)
.append("id", this.id)
.append("notes",this.notes)
.append("copyrightStatus",this.copyrightStatus)
.append("acknowledgementNotes",this.acknowledgementNotes)
.append("description",this.description)
.append("title", this.title)
.append("status",this.status)
.toString();
}
}
The resulting hbm file is as follows, this what you were expecting to see as I still have the same result: