0 Replies Latest reply on Mar 6, 2006 8:56 PM by song hao

    @JoinColumn problem

    song hao Newbie

      Hi, all
      I have a problem about @JoinColumn.


      public class Status implements Serializable {
       private String Status_ID;
       private String Status_Msg;
       public String getStatus_ID() {
       return Status_ID;
       public void setStatus_ID(String status_id) {
       Status_ID = status_id;
       public String getStatus_Msg() {
       return Status_Msg;
       public void setStatus_Msg(String status_msg) {
       Status_Msg = status_msg;

      Table Status:
      Status_ID Status_Msg
      ----------- --------------
       O Open
       C Close
       F Fatal

      Table Status have three lines data, unallowed insert other data.

      public class Light implements Serializable {
       private String Light_Name;
       @JoinColumn(name = "Light_Status", referencedColumnName="Status_ID")
       private Status LightStatus;
       public String getLight_Name() {
       return Light_Name;
       public void setLight_Name(String light_name) {
       Light_Name = light_name;
       public Status getLightStatus() {
       return LightStatus;
       public void setLightStatus(Status lightstatus) {
       LightStatus = lightstatus;

      Table Light
      Light_Name Light_Status
      -------------- --------------
      light1 O
      light2 O
      light3 C
      light4 F

      Table Light Column Light_Status, auto create in @JoinColumn, not have setter/getter. How to do when i want to chang "light2" to Close(change Light_Status to "C").

      another question:

      Table Desk:
      Desk_Zone Desk_ID
      ------------- -----------
       A 01
       B 09

      Table ChkAllo

      How to create the OneToOne relationship about Desk.Desk_Zone + Desk.Desk_ID = ChkAllo.Desk_Code?