Hi, all
I have a problem about @JoinColumn.

Status.java

@Entity
  | public class Status implements Serializable {
  |       @Id
  |       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.

Light.java
@Entity
  | public class Light implements Serializable {
  |       @Id
  |       private String Light_Name;
  | 
  |       @ManyToOne
  |       @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
Desk_Code
  | -------------
  |     A01
  |     B09

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

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3928349#3928349

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3928349


-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to