- This topic has 11 replies, 2 voices, and was last updated 17 years, 1 month ago by Riyad Kalla.
-
AuthorPosts
-
yulun74MemberHi,
I have used the MyEclipse 6 to generate the EJB entity and facade classes.
I have two tables (objects) and one is called Facility and the other is called Location.
A facility can have one to many locations and many to one location below to a facility.
The primary key id for facility table is a Oracle auto generated sequence number called facility id and the primary key id for location table is also a Oracle auto generated sequence number with a foreign key of facility id.MyEclipse has generated 3 entity classes as Facility,FacilityLocation, and FacilityLocationId.
When I ran the test to populate the data, I got the following error:
ids for this class must be manually assigned before calling save():ejb.FacilityLocation
This is my test case.
serviceLocator se = new serviceLocator();
FacilityFacadeLocal fal = (FacilityFacadeLocal)se.lookupFacilityFacade();
List locationList = new Vector();Facility fac = new Facility;
fac.setName(“ABC”);FacilityLocation facLocation1 = new FacilityLocation();
facLocation1.setLocationName(“123”);
locationList .add(facLocation1);FacilityLocation facLocation2 = new FacilityLocation();
facLocation2.setLocationName(“456”);
locationList .add(facLocation1);fac.setFacilityLocations(locationList );
fal.save(fac);What did I do wrong? Please help.
Riyad KallaMemberCan you post the DDL for both the tables here for me?
yulun74Member@support-rkalla wrote:
Can you post the DDL for both the tables here for me?
Hi,
Here are three class generated and used for those two tables.
Thank you very much for your help.Facility
****************************************************************************
package us.state.ga.pap.ejb;import java.util.Collection;
import java.util.Date;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.OneToMany;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;/**
* Facility generated by MyEclipse Persistence Tools
*/
@Entity
@Table(name = “FACILITY”, schema = “THOR2”, uniqueConstraints = {})
//@SequenceGenerator(name = “facility_id_sequence”, sequenceName = “FACILITY_ID_SEQ”)
public class Facility implements java.io.Serializable {// Fields
private Long facilityId;
private String facName;
private String officeStreet;
private String officeCity;
private String officeState;
private String officeZip;
private Date createDate;
private String createdBy;
private Date updateDate;
private String updatedBy;
private String modApprovedF;
private String modApprovedBy;
private Date modApprovedDate;
private String mailingStreet;
private String mailingCity;
private String mailingState;
private String mailingZip;
private String referralContactFname;
private String referralContactLname;
private String referralContactPhone;
private String referralContactCellPhone;
private String referralContactBeeper;
private String referralContactEmail;
private String directorFname;
private String directorLname;
private String directorPhone;
private String directorCellPhone;
private String directorBeeper;
private String directorEmail;
private String drivingDirections;
private String website;
private Collection<FacilityLocation> facilityLocations;
// Constructors/** default constructor */
public Facility() {
}/** minimal constructor */
public Facility(Long facilityId) {
this.facilityId = facilityId;
}/** full constructor */
public Facility(Long facilityId, String facName, String officeStreet,
String officeCity, String officeState, String officeZip,
Date createDate, String createdBy, Date updateDate,
String updatedBy, String modApprovedF, String modApprovedBy,
Date modApprovedDate, String mailingStreet, String mailingCity,
String mailingState, String mailingZip,
String referralContactFname, String referralContactLname,
String referralContactPhone, String referralContactCellPhone,
String referralContactBeeper, String referralContactEmail,
String directorFname, String directorLname, String directorPhone,
String directorCellPhone, String directorBeeper,
String directorEmail, String drivingDirections, String website,
Set<FacilityLocation> facilityLocations) {
this.facilityId = facilityId;
this.facName = facName;
this.officeStreet = officeStreet;
this.officeCity = officeCity;
this.officeState = officeState;
this.officeZip = officeZip;
this.createDate = createDate;
this.createdBy = createdBy;
this.updateDate = updateDate;
this.updatedBy = updatedBy;
this.modApprovedF = modApprovedF;
this.modApprovedBy = modApprovedBy;
this.modApprovedDate = modApprovedDate;
this.mailingStreet = mailingStreet;
this.mailingCity = mailingCity;
this.mailingState = mailingState;
this.mailingZip = mailingZip;
this.referralContactFname = referralContactFname;
this.referralContactLname = referralContactLname;
this.referralContactPhone = referralContactPhone;
this.referralContactCellPhone = referralContactCellPhone;
this.referralContactBeeper = referralContactBeeper;
this.referralContactEmail = referralContactEmail;
this.directorFname = directorFname;
this.directorLname = directorLname;
this.directorPhone = directorPhone;
this.directorCellPhone = directorCellPhone;
this.directorBeeper = directorBeeper;
this.directorEmail = directorEmail;
this.drivingDirections = drivingDirections;
this.website = website;
this.facilityLocations = facilityLocations;
}// Property accessors
@Id
@Column(name = “FACILITY_ID”, unique = true, nullable = false, insertable = true, updatable = true, precision = 22, scale = 0)
@GeneratedValue(strategy = GenerationType.SEQUENCE)
public Long getFacilityId() {
return this.facilityId;
}public void setFacilityId(Long facilityId) {
this.facilityId = facilityId;
}@Column(name = “FAC_NAME”, unique = false, nullable = true, insertable = true, updatable = true, length = 500)
public String getFacName() {
return this.facName;
}public void setFacName(String facName) {
this.facName = facName;
}@Column(name = “OFFICE_STREET”, unique = false, nullable = true, insertable = true, updatable = true, length = 500)
public String getOfficeStreet() {
return this.officeStreet;
}public void setOfficeStreet(String officeStreet) {
this.officeStreet = officeStreet;
}@Column(name = “OFFICE_CITY”, unique = false, nullable = true, insertable = true, updatable = true, length = 100)
public String getOfficeCity() {
return this.officeCity;
}public void setOfficeCity(String officeCity) {
this.officeCity = officeCity;
}@Column(name = “OFFICE_STATE”, unique = false, nullable = true, insertable = true, updatable = true, length = 2)
public String getOfficeState() {
return this.officeState;
}public void setOfficeState(String officeState) {
this.officeState = officeState;
}@Column(name = “OFFICE_ZIP”, unique = false, nullable = true, insertable = true, updatable = true, length = 11)
public String getOfficeZip() {
return this.officeZip;
}public void setOfficeZip(String officeZip) {
this.officeZip = officeZip;
}@Temporal(TemporalType.DATE)
@Column(name = “CREATE_DATE”, unique = false, nullable = true, insertable = true, updatable = true, length = 7)
public Date getCreateDate() {
return this.createDate;
}public void setCreateDate(Date createDate) {
this.createDate = createDate;
}@Column(name = “CREATED_BY”, unique = false, nullable = true, insertable = true, updatable = true, length = 200)
public String getCreatedBy() {
return this.createdBy;
}public void setCreatedBy(String createdBy) {
this.createdBy = createdBy;
}@Temporal(TemporalType.DATE)
@Column(name = “UPDATE_DATE”, unique = false, nullable = true, insertable = true, updatable = true, length = 7)
public Date getUpdateDate() {
return this.updateDate;
}public void setUpdateDate(Date updateDate) {
this.updateDate = updateDate;
}@Column(name = “UPDATED_BY”, unique = false, nullable = true, insertable = true, updatable = true, length = 200)
public String getUpdatedBy() {
return this.updatedBy;
}public void setUpdatedBy(String updatedBy) {
this.updatedBy = updatedBy;
}@Column(name = “MOD_APPROVED_F”, unique = false, nullable = true, insertable = true, updatable = true, length = 1)
public String getModApprovedF() {
return this.modApprovedF;
}public void setModApprovedF(String modApprovedF) {
this.modApprovedF = modApprovedF;
}@Column(name = “MOD_APPROVED_BY”, unique = false, nullable = true, insertable = true, updatable = true, length = 200)
public String getModApprovedBy() {
return this.modApprovedBy;
}public void setModApprovedBy(String modApprovedBy) {
this.modApprovedBy = modApprovedBy;
}@Temporal(TemporalType.DATE)
@Column(name = “MOD_APPROVED_DATE”, unique = false, nullable = true, insertable = true, updatable = true, length = 7)
public Date getModApprovedDate() {
return this.modApprovedDate;
}public void setModApprovedDate(Date modApprovedDate) {
this.modApprovedDate = modApprovedDate;
}@Column(name = “MAILING_STREET”, unique = false, nullable = true, insertable = true, updatable = true, length = 1000)
public String getMailingStreet() {
return this.mailingStreet;
}public void setMailingStreet(String mailingStreet) {
this.mailingStreet = mailingStreet;
}@Column(name = “MAILING_CITY”, unique = false, nullable = true, insertable = true, updatable = true, length = 500)
public String getMailingCity() {
return this.mailingCity;
}public void setMailingCity(String mailingCity) {
this.mailingCity = mailingCity;
}@Column(name = “MAILING_STATE”, unique = false, nullable = true, insertable = true, updatable = true, length = 2)
public String getMailingState() {
return this.mailingState;
}public void setMailingState(String mailingState) {
this.mailingState = mailingState;
}@Column(name = “MAILING_ZIP”, unique = false, nullable = true, insertable = true, updatable = true, length = 11)
public String getMailingZip() {
return this.mailingZip;
}public void setMailingZip(String mailingZip) {
this.mailingZip = mailingZip;
}@Column(name = “REFERRAL_CONTACT_FNAME”, unique = false, nullable = true, insertable = true, updatable = true, length = 500)
public String getReferralContactFname() {
return this.referralContactFname;
}public void setReferralContactFname(String referralContactFname) {
this.referralContactFname = referralContactFname;
}@Column(name = “REFERRAL_CONTACT_LNAME”, unique = false, nullable = true, insertable = true, updatable = true, length = 500)
public String getReferralContactLname() {
return this.referralContactLname;
}public void setReferralContactLname(String referralContactLname) {
this.referralContactLname = referralContactLname;
}@Column(name = “REFERRAL_CONTACT_PHONE”, unique = false, nullable = true, insertable = true, updatable = true, length = 50)
public String getReferralContactPhone() {
return this.referralContactPhone;
}public void setReferralContactPhone(String referralContactPhone) {
this.referralContactPhone = referralContactPhone;
}@Column(name = “REFERRAL_CONTACT_CELL_PHONE”, unique = false, nullable = true, insertable = true, updatable = true, length = 50)
public String getReferralContactCellPhone() {
return this.referralContactCellPhone;
}public void setReferralContactCellPhone(String referralContactCellPhone) {
this.referralContactCellPhone = referralContactCellPhone;
}@Column(name = “REFERRAL_CONTACT_BEEPER”, unique = false, nullable = true, insertable = true, updatable = true, length = 100)
public String getReferralContactBeeper() {
return this.referralContactBeeper;
}public void setReferralContactBeeper(String referralContactBeeper) {
this.referralContactBeeper = referralContactBeeper;
}@Column(name = “REFERRAL_CONTACT_EMAIL”, unique = false, nullable = true, insertable = true, updatable = true, length = 100)
public String getReferralContactEmail() {
return this.referralContactEmail;
}public void setReferralContactEmail(String referralContactEmail) {
this.referralContactEmail = referralContactEmail;
}@Column(name = “DIRECTOR_FNAME”, unique = false, nullable = true, insertable = true, updatable = true, length = 500)
public String getDirectorFname() {
return this.directorFname;
}public void setDirectorFname(String directorFname) {
this.directorFname = directorFname;
}@Column(name = “DIRECTOR_LNAME”, unique = false, nullable = true, insertable = true, updatable = true, length = 500)
public String getDirectorLname() {
return this.directorLname;
}public void setDirectorLname(String directorLname) {
this.directorLname = directorLname;
}@Column(name = “DIRECTOR_PHONE”, unique = false, nullable = true, insertable = true, updatable = true, length = 50)
public String getDirectorPhone() {
return this.directorPhone;
}public void setDirectorPhone(String directorPhone) {
this.directorPhone = directorPhone;
}@Column(name = “DIRECTOR_CELL_PHONE”, unique = false, nullable = true, insertable = true, updatable = true, length = 50)
public String getDirectorCellPhone() {
return this.directorCellPhone;
}public void setDirectorCellPhone(String directorCellPhone) {
this.directorCellPhone = directorCellPhone;
}@Column(name = “DIRECTOR_BEEPER”, unique = false, nullable = true, insertable = true, updatable = true, length = 100)
public String getDirectorBeeper() {
return this.directorBeeper;
}public void setDirectorBeeper(String directorBeeper) {
this.directorBeeper = directorBeeper;
}@Column(name = “DIRECTOR_EMAIL”, unique = false, nullable = true, insertable = true, updatable = true, length = 100)
public String getDirectorEmail() {
return this.directorEmail;
}public void setDirectorEmail(String directorEmail) {
this.directorEmail = directorEmail;
}@Column(name = “DRIVING_DIRECTIONS”, unique = false, nullable = true, insertable = true, updatable = true, length = 2000)
public String getDrivingDirections() {
return this.drivingDirections;
}public void setDrivingDirections(String drivingDirections) {
this.drivingDirections = drivingDirections;
}@Column(name = “WEBSITE”, unique = false, nullable = true, insertable = true, updatable = true, length = 500)
public String getWebsite() {
return this.website;
}public void setWebsite(String website) {
this.website = website;
}public void setFacilityLocations(Collection<FacilityLocation> facilityLocations) {
this.facilityLocations = facilityLocations;
}
}FacilityLocation
*****************************************************************************
package us.state.ga.pap.ejb;import java.util.Date;
import javax.persistence.AttributeOverride;
import javax.persistence.AttributeOverrides;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;/**
* FacilityLocation Persis Tools
*/
@Entity
@Table(name = “FACILITY_LOCATION”, schema = “THOR2”, uniqueConstraints = {})
public class FacilityLocation implements java.io.Serializable {// Fields
private FacilityLocationId id;
private Facility facility;
private String street;
private String city;
private String state;
private String zip;
private String phone;
private String countyCode;
private String genCom;
private String activeLocationF;
private Date createDate;
private String createdBy;
private Date updateDate;
private String updatedBy;
private String modApprovedF;
private String modApprovedBy;
private Date modApprovedDate;// Constructors
/** default constructor */
public FacilityLocation() {
}/** minimal constructor */
public FacilityLocation(FacilityLocationId id, Facility facility) {
this.id = id;
this.facility = facility;
}/** full constructor */
public FacilityLocation(FacilityLocationId id, Facility facility,
String street, String city, String state, String zip, String phone,
String countyCode, String genCom, String activeLocationF,
Date createDate, String createdBy, Date updateDate,
String updatedBy, String modApprovedF, String modApprovedBy,
Date modApprovedDate) {
this.id = id;
this.facility = facility;
this.street = street;
this.city = city;
this.state = state;
this.zip = zip;
this.phone = phone;
this.countyCode = countyCode;
this.genCom = genCom;
this.activeLocationF = activeLocationF;
this.createDate = createDate;
this.createdBy = createdBy;
this.updateDate = updateDate;
this.updatedBy = updatedBy;
this.modApprovedF = modApprovedF;
this.modApprovedBy = modApprovedBy;
this.modApprovedDate = modApprovedDate;
}// Property accessors
@EmbeddedId
@AttributeOverrides( {
@AttributeOverride(name = “facilityId”, column = @Column(name = “FACILITY_ID”, unique = true, nullable = false, insertable = true, updatable = true, precision = 22, scale = 0)),
@AttributeOverride(name = “locationId”, column = @Column(name = “LOCATION_ID”, unique = true, nullable = false, insertable = true, updatable = true, precision = 22, scale = 0))})
public FacilityLocationId getId() {
return this.id;
}public void setId(FacilityLocationId id) {
this.id = id;
}@ManyToOne(cascade = {CascadeType.ALL}, fetch = FetchType.LAZY)
@JoinColumn(name = “FACILITY_ID”, unique = false, nullable = false, insertable = false, updatable = false)
public Facility getFacility() {
return this.facility;
}public void setFacility(Facility facility) {
this.facility = facility;
}@Column(name = “STREET”, unique = false, nullable = true, insertable = true, updatable = true, length = 500)
public String getStreet() {
return this.street;
}public void setStreet(String street) {
this.street = street;
}@Column(name = “CITY”, unique = false, nullable = true, insertable = true, updatable = true, length = 100)
public String getCity() {
return this.city;
}public void setCity(String city) {
this.city = city;
}@Column(name = “STATE”, unique = false, nullable = true, insertable = true, updatable = true, length = 2)
public String getState() {
return this.state;
}public void setState(String state) {
this.state = state;
}@Column(name = “ZIP”, unique = false, nullable = true, insertable = true, updatable = true, length = 11)
public String getZip() {
return this.zip;
}public void setZip(String zip) {
this.zip = zip;
}@Column(name = “PHONE”, unique = false, nullable = true, insertable = true, updatable = true, length = 20)
public String getPhone() {
return this.phone;
}public void setPhone(String phone) {
this.phone = phone;
}@Column(name = “COUNTY_CODE”, unique = false, nullable = true, insertable = true, updatable = true, length = 4)
public String getCountyCode() {
return this.countyCode;
}public void setCountyCode(String countyCode) {
this.countyCode = countyCode;
}@Column(name = “GEN_COM”, unique = false, nullable = true, insertable = true, updatable = true, length = 2000)
public String getGenCom() {
return this.genCom;
}public void setGenCom(String genCom) {
this.genCom = genCom;
}@Column(name = “ACTIVE_LOCATION_F”, unique = false, nullable = true, insertable = true, updatable = true, length = 1)
public String getActiveLocationF() {
return this.activeLocationF;
}public void setActiveLocationF(String activeLocationF) {
this.activeLocationF = activeLocationF;
}@Temporal(TemporalType.DATE)
@Column(name = “CREATE_DATE”, unique = false, nullable = true, insertable = true, updatable = true, length = 7)
public Date getCreateDate() {
return this.createDate;
}public void setCreateDate(Date createDate) {
this.createDate = createDate;
}@Column(name = “CREATED_BY”, unique = false, nullable = true, insertable = true, updatable = true, length = 200)
public String getCreatedBy() {
return this.createdBy;
}public void setCreatedBy(String createdBy) {
this.createdBy = createdBy;
}@Temporal(TemporalType.DATE)
@Column(name = “UPDATE_DATE”, unique = false, nullable = true, insertable = true, updatable = true, length = 7)
public Date getUpdateDate() {
return this.updateDate;
}public void setUpdateDate(Date updateDate) {
this.updateDate = updateDate;
}@Column(name = “UPDATED_BY”, unique = false, nullable = true, insertable = true, updatable = true, length = 200)
public String getUpdatedBy() {
return this.updatedBy;
}public void setUpdatedBy(String updatedBy) {
this.updatedBy = updatedBy;
}@Column(name = “MOD_APPROVED_F”, unique = false, nullable = true, insertable = true, updatable = true, length = 1)
public String getModApprovedF() {
return this.modApprovedF;
}public void setModApprovedF(String modApprovedF) {
this.modApprovedF = modApprovedF;
}@Column(name = “MOD_APPROVED_BY”, unique = false, nullable = true, insertable = true, updatable = true, length = 200)
public String getModApprovedBy() {
return this.modApprovedBy;
}public void setModApprovedBy(String modApprovedBy) {
this.modApprovedBy = modApprovedBy;
}@Temporal(TemporalType.DATE)
@Column(name = “MOD_APPROVED_DATE”, unique = false, nullable = true, insertable = true, updatable = true, length = 7)
public Date getModApprovedDate() {
return this.modApprovedDate;
}public void setModApprovedDate(Date modApprovedDate) {
this.modApprovedDate = modApprovedDate;
}
}FacilityLocationId
************************************************************************
package us.state.ga.pap.ejb;import javax.persistence.Column;
import javax.persistence.Embeddable;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.SequenceGenerator;/**
* FacilityLocationId generated by MyEclipse Persistence Tools
*/
@Embeddable
public class FacilityLocationId implements java.io.Serializable {// Fields
private Long facilityId;
private Long locationId;// Constructors
/** default constructor */
public FacilityLocationId() {
}/** full constructor */
public FacilityLocationId(Long facilityId, Long locationId) {
this.facilityId = facilityId;
this.locationId = locationId;
}// Property accessors
@Column(name = “FACILITY_ID”, unique = true, nullable = false, insertable = true, updatable = true, precision = 22, scale = 0)
public Long getFacilityId() {
return this.facilityId;
}public void setFacilityId(Long facilityId) {
this.facilityId = facilityId;
}@Column(name = “LOCATION_ID”, unique = true, nullable = false, insertable = true, updatable = true, precision = 22, scale = 0)
@GeneratedValue(strategy = GenerationType.SEQUENCE)
public Long getLocationId() {
return this.locationId;
}public void setLocationId(Long locationId) {
this.locationId = locationId;
}public boolean equals(Object other) {
if ((this == other))
return true;
if ((other == null))
return false;
if (!(other instanceof FacilityLocationId))
return false;
FacilityLocationId castOther = (FacilityLocationId) other;return ((this.getFacilityId() == castOther.getFacilityId()) || (this
.getFacilityId() != null
&& castOther.getFacilityId() != null && this.getFacilityId()
.equals(castOther.getFacilityId())))
&& ((this.getLocationId() == castOther.getLocationId()) || (this
.getLocationId() != null
&& castOther.getLocationId() != null && this
.getLocationId().equals(castOther.getLocationId())));
}public int hashCode() {
int result = 17;result = 37
* result
+ (getFacilityId() == null ? 0 : this.getFacilityId()
.hashCode());
result = 37
* result
+ (getLocationId() == null ? 0 : this.getLocationId()
.hashCode());
return result;
}
}
Riyad KallaMemberWoops,
not the classes, but the actual DDL for the tables (the “CREATE TABLES” statements)
yulun74Member@support-rkalla wrote:
Woops,
not the classes, but the actual DDL for the tables (the “CREATE TABLES” statements)Sorry for the misunderstanding. Here are the DDL for those two tables. Thank you.
Facility
***************************************************************
create table “THOR2”.”FACILITY”(
“FACILITY_ID” NUMBER not null,
“FAC_NAME” VARCHAR2(500) unique,
“OFFICE_STREET” VARCHAR2(500),
“OFFICE_CITY” VARCHAR2(100),
“OFFICE_STATE” VARCHAR2(2),
“OFFICE_ZIP” VARCHAR2(11),
“CREATE_DATE” DATE,
“CREATED_BY” VARCHAR2(200),
“UPDATE_DATE” DATE,
“UPDATED_BY” VARCHAR2(200),
“MOD_APPROVED_F” VARCHAR2(1),
“MOD_APPROVED_BY” VARCHAR2(200),
“MOD_APPROVED_DATE” DATE,
“MAILING_STREET” VARCHAR2(1000),
“MAILING_CITY” VARCHAR2(500),
“MAILING_STATE” VARCHAR2(2),
“MAILING_ZIP” VARCHAR2(11),
“REFERRAL_CONTACT_FNAME” VARCHAR2(500),
“REFERRAL_CONTACT_LNAME” VARCHAR2(500),
“REFERRAL_CONTACT_PHONE” VARCHAR2(50),
“REFERRAL_CONTACT_CELL_PHONE” VARCHAR2(50),
“REFERRAL_CONTACT_BEEPER” VARCHAR2(100),
“REFERRAL_CONTACT_EMAIL” VARCHAR2(100),
“DIRECTOR_FNAME” VARCHAR2(500),
“DIRECTOR_LNAME” VARCHAR2(500),
“DIRECTOR_PHONE” VARCHAR2(50),
“DIRECTOR_CELL_PHONE” VARCHAR2(50),
“DIRECTOR_BEEPER” VARCHAR2(100),
“DIRECTOR_EMAIL” VARCHAR2(100),
“DRIVING_DIRECTIONS” VARCHAR2(2000),
“WEBSITE” VARCHAR2(500),
constraint “PK_FACILITY” primary key (“FACILITY_ID”)
);
comment on table “THOR2″.”FACILITY” is ‘holds the contacts information about the facility’;create unique index “THOR2″.”PK_FACILITY” on “THOR2”.”FACILITY”(“FACILITY_ID”);
create index “THOR2″.”IDX_F_FAC_NAME” on “THOR2”.”FACILITY”(“FAC_NAME”);Facility_Location
**************************************************************************create table “THOR2”.”FACILITY_LOCATION”(
“FACILITY_ID” NUMBER not null,
“LOCATION_ID” NUMBER not null,
“STREET” VARCHAR2(500),
“CITY” VARCHAR2(100),
“STATE” VARCHAR2(2),
“ZIP” VARCHAR2(11),
“PHONE” VARCHAR2(20),
“COUNTY_CODE” VARCHAR2(4),
“GEN_COM” VARCHAR2(2000),
“ACTIVE_LOCATION_F” VARCHAR2(1),
“CREATE_DATE” DATE,
“CREATED_BY” VARCHAR2(200),
“UPDATE_DATE” DATE,
“UPDATED_BY” VARCHAR2(200),
“MOD_APPROVED_F” VARCHAR2(1),
“MOD_APPROVED_BY” VARCHAR2(200),
“MOD_APPROVED_DATE” DATE,
“FACILITYLOCATIONS_FACILITY_ID” NUMBER(19),
“FACILITYLOCATIONS_LOCATION_ID” NUMBER(19),
constraint “PK_FAC_LOCATION” primary key (“FACILITY_ID”,”LOCATION_ID”)
);
comment on table “THOR2″.”FACILITY_LOCATION” is ‘Hold location information about a facility. Right now, a facility can have up to 10 locations’;alter table “THOR2″.”FACILITY_LOCATION”
add constraint “FK_FAC_FAC_LOC”
foreign key (“FACILITY_ID”)
references “THOR2”.”FACILITY”(“FACILITY_ID”);
alter table “THOR2″.”FACILITY_LOCATION”
add constraint “FKAFA329D1B4058833”
foreign key (“FACILITYLOCATIONS_FACILITY_ID”,”FACILITYLOCATIONS_LOCATION_ID”)
references “THOR2”.”FACILITY_LOCATION”(“FACILITY_ID”,”LOCATION_ID”);
create unique index “THOR2″.”PK_FAC_LOCATION” on “THOR2”.”FACILITY_LOCATION”(“FACILITY_ID”,”LOCATION_ID”);
create index “THOR2″.”IDX_FL_ALF” on “THOR2”.”FACILITY_LOCATION”(“ACTIVE_LOCATION_F”);
Riyad KallaMemberOh I see, you are getting the composite ID because you have marked your FACILITY_ID and LOCATION_ID as your PK, but I guess only your LOCATION_ID is the PK, and FACILITY_ID should be only an FK back to your original table.
That should generate a simple POJO setup if you make those changes.
yulun74MemberYes, sir. Thank you for your help.
The table has two primary keys instead of one. It needs to be corrected.
Riyad KallaMemberNo problem
yulun74MemberThis message has not been recovered.
Riyad KallaMemberThis message has not been recovered.
yulun74MemberThis message has not been recovered.
Riyad KallaMemberThis message has not been recovered.
-
AuthorPosts