CREATE TABLE TB_HOUR_DATA
(
STAT_DATE DATE NOT NULL
PATH_ID NUMBER(
VALUE VARCHAR
TYPE NUMBER(
)
其中
針對這種情況
package net
import java
import java
import javax
import javax
import javax
import javax
import javax
import javax
@Embeddable
public class HourDataPK implements Serializable {
/** *//**
*
*/
private static final long serialVersionUID =
@ManyToOne
@JoinColumn(name =
private Path path;
@Column(name =
@Temporal(TemporalType
private Date statDate;
private int type;
public Path getPath() {
return path;
}
public void setPath(Path path) {
this
}
public Date getStatDate() {
return statDate;
}
public void setStatDate(Date statDate) {
this
}
public int getType() {
return type;
}
public void setType(int type) {
this
}
}
package net
import java
import javax
import javax
import javax
import nere
@Entity
@Table(name =
public class HourData implements Serializable {
/** *//**
*
*/
private static final long serialVersionUID =
@EmbeddedId
private HourDataPK pk;
private String value;
public String getValue() {
return value;
}
public void setValue(String value) {
this
}
public int[] getHours() {
return parseValue(value);
}
private int[] parseValue(String value) {
int[] result = new int[
for (int i =
result[i] =
}
if (value == null) {
return result;
}
String[] hs = Text
int len = Math
for (int i =
result[i] = Text
}
return result;
}
public void setHours(int[] hours) {
int[] tHours = parseValue(value);
StringBuilder sb = new StringBuilder();
int len = Math
for (int i =
sb
}
sb
this
}
public HourDataPK getPk() {
return pk;
}
public void setPk(HourDataPK pk) {
this
}
}
From:http://tw.wingwit.com/Article/program/Java/ky/201311/28530.html