Hi,
I'm using Eclipse Galileo on Mac 10.5.6, Oracle 10g, Java 1.5, and Hibernate 3.3.0.GA. I'm trying to build a Java model in which I want one field to have a one-to-many relationship to another model. The corresponding db tables have been created. In my .java class, I tried defining it like this ...
@OneToMany
@JoinTable(name = "VENDOR_EMAILS",
joinColumns = {
@JoinColumn(name="VENDOR_ID", unique = true)
},
inverseJoinColumns = {
@JoinColumn(name="VENDOR_ID")
}
)
private List<YouthfulDriverVendorEmail> emails;
but I'm getting these compilation errors ...
[javac] Compiling 4 source files to /Users/dalvarado/source/youthful/model/target/classes
[javac] /Users/dalvarado/source/youthful/model/src/main/java/myco/dor/dmv/driver/youthful/model/YouthfulDriverVendor.java:52: cannot find symbol
[javac] symbol : class OneToMany
[javac] location: class myco.dor.dmv.driver.youthful.model.YouthfulDriverVendor
[javac] @OneToMany
[javac] ^
[javac] /Users/dalvarado/source/youthful/model/src/main/java/myco/dor/dmv/driver/youthful/model/YouthfulDriverVendor.java:53: cannot find symbol
[javac] symbol : class JoinTable
[javac] location: class myco.dor.dmv.driver.youthful.model.YouthfulDriverVendor
[javac] @JoinTable(name = "VENDOR_EMAILS",
[javac] ^
[javac] 2 errors
Does anyone know what I'm doing wrong? Below is the complete code for my class. Thanks in advance, - Dave
package myco.dor.dmv.driver.youthful.model;
import java.io.File;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
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;
@Column(name="EMAIL", length=256)
private String email;
@OneToMany
@JoinTable(name = "VENDOR_EMAILS",
joinColumns = {
@JoinColumn(name="VENDOR_ID", unique = true)
},
inverseJoinColumns = {
@JoinColumn(name="VENDOR_ID")
}
)
private List<YouthfulDriverVendorEmail> emails;
public List<YouthfulDriverVendorEmail> getEmails() {
return emails;
}
public void setEmails(List<YouthfulDriverVendorEmail> emails) {
this.emails = emails;
}
/**
* 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;
}
/**
* Get the <code>Email</code> value.
*
* @return a <code>String</code> value
*/
public String getEmail() {
return email;
}
/**
* Set the <code>Email</code> value.
*
* @param newEmail The new Email value.
*/
public void setEmail(final String newEmail) {
this.email = newEmail;
}
}