Hi,
I'm using hibernate 3.4.0.GA, Java 1.5, and Oracle 10g. I have these mappings in my hibernate.cfg.xml file ...
Code:
<mapping class="myco.dor.dmv.driver.youthful.model.Vendor"/>
<mapping class="myco.dor.dmv.driver.youthful.model.VendorEmail"/>
Vendor and vendor emails are separate DB tables. One vendor can map to zero or many vendor emails. My question is, what do I need to do to expand my vendor model so that there is some kind of method that would return a group of mapped emails? Below is the code of my vendor model. Thanks, - Dave
Code:
package myco.dor.dmv.driver.youthful.model;
import java.io.File;
import java.io.Serializable;
import java.util.Date;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.SequenceGenerator;
@Entity
@Table(name="VENDORS")
public class YouthfulDriverVendor implements Serializable {
private static final long serialVersionUID = -1L;
@Id
@Column(name="VENDOR_ID")
@GeneratedValue(generator="VENDORID_GENERATOR")
@SequenceGenerator(name="VENDORID_GENERATOR",
sequenceName="VENDOR_ID")
private Long vendorId;
@Column(name="CUSTOMER_ID")
private Long customerId;
@Column(name="ACTIVATION_DATE")
private Date activationDate;
@Column(name="EXPIRATION_DATE")
private Date expirationDate;
@Column(name="KEY_ID", length=128)
private String keyId;
@Column(name="VENDOR_NAME", length=512)
private String vendorName;
@Column(name="FTP_HOME", length=512)
private String ftpHome;
@Column(name="USER_NAME", length=64)
private String username;
/**
* Get the <code>VendorId</code> value.
*
* @return a <code>Long</code> value
*/
public Long getVendorId() {
return vendorId;
}
/**
* Set the <code>VendorId</code> value.
*
* @param newVendorId The new VendorId value.
*/
public void setVendorId(final Long newVendorId) {
this.vendorId = newVendorId;
}
/**
* Get the <code>CustomerId</code> value.
*
* @return a <code>Long</code> value
*/
public Long getCustomerId() {
return customerId;
}
/**
* Set the <code>CustomerId</code> value.
*
* @param newCustomerId The new CustomerId value.
*/
public void setCustomerId(final Long newCustomerId) {
this.customerId = newCustomerId;
}
/**
* Get the <code>ActivationDate</code> value.
*
* @return a <code>Date</code> value
*/
public Date getActivationDate() {
return activationDate;
}
/**
* Set the <code>ActivationDate</code> value.
*
* @param newActivationDate The new ActivationDate value.
*/
public void setActivationDate(final Date newActivationDate) {
this.activationDate = newActivationDate;
}
/**
* Get the <code>ExpirationDate</code> value.
*
* @return a <code>Date</code> value
*/
public Date getExpirationDate() {
return expirationDate;
}
/**
* Set the <code>ExpirationDate</code> value.
*
* @param newExpirationDate The new ExpirationDate value.
*/
public void setExpirationDate(final Date newExpirationDate) {
this.expirationDate = newExpirationDate;
}
/**
* Get the <code>KeyId</code> value.
*
* @return a <code>String</code> value
*/
public String getKeyId() {
return keyId;
}
/**
* Set the <code>KeyId</code> value.
*
* @param newKeyId The new KeyId value.
*/
public void setKeyId(final String newKeyId) {
this.keyId = newKeyId;
}
/**
* Get the <code>VendorName</code> value.
*
* @return a <code>String</code> value
*/
public String getVendorName() {
return vendorName;
}
/**
* Set the <code>VendorName</code> value.
*
* @param newVendorName The new VendorName value.
*/
public void setVendorName(final String newVendorName) {
this.vendorName = newVendorName;
}
/**
* Get the <code>FtpHome</code> value.
*
* @return a <code>String</code> value
*/
public String getFtpHome() {
return ftpHome;
}
/**
* Get the Ftp Inbox value.
*
* @return a File object containing this value
*/
public File getFtpInbox() {
return new File(this.getFtpHome(), "INBOX");
} // getFtpInbox
/**
* Get the Ftp Inbox value.
*
* @return a File object containing this value
*/
public File getFtpOutbox() {
return new File(this.getFtpHome(), "OUTBOX");
} // getFtpInbox
/**
* Set the <code>FtpHome</code> value.
*
* @param newFtpHome The new FtpHome value.
*/
public void setFtpHome(final String newFtpHome) {
this.ftpHome = newFtpHome;
}
/**
* Get the <code>Username</code> value.
*
* @return a <code>String</code> value
*/
public String getUsername() {
return username;
}
/**
* Set the <code>Username</code> value.
*
* @param newUsername The new Username value.
*/
public void setUsername(final String newUsername) {
this.username = newUsername;
}
}