在我的基于 Hibernate Annotation 的应用程序中......我正在创建这样的表..
CREATE TABLE IF NOT EXISTS `EC_USER` (
`S_ID` VARCHAR(30) NOT NULL PRIMARY KEY,
`CREATED_DATE` DATETIME NULL ,
`MODIFIED_BY` VARCHAR(30) NULL ,
CONSTRAINT `CREATED_BY`
FOREIGN KEY (`CREATED_BY` )
REFERENCES `EC_USER` (`S_ID` )
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `MODIFIED_BY`
FOREIGN KEY (`MODIFIED_BY` )
REFERENCES `EC_USER` (`S_ID` )
ON DELETE NO ACTION
ON UPDATE NO ACTION)
那么如何编写我的 Hibernate Bean ......
@Entity
@Table(name = "EC_USER")
public class UserVO{
@Id
@Column(name="S_ID")
private String id;
@Column(name = "CREATED_DATE")
private Date createdDate;
@Column(name = "LAST_MODIFIED_DATE")
private Date modifiedDate;
}
所以这是正确的一个或任何关系映射需要......