@ElementCollection 组件集合映射(二)

级联关系:

145938_I0eV_2493805.png

package com.bbg.fms.model;


import java.util.Date;

import java.util.List;


import javax.persistence.CollectionTable;

import javax.persistence.Column;

import javax.persistence.ElementCollection;

import javax.persistence.Entity;

import javax.persistence.GeneratedValue;

import javax.persistence.Id;

import javax.persistence.JoinColumn;

import javax.persistence.OrderBy;

import javax.persistence.Table;

import javax.persistence.Transient;


import org.hibernate.annotations.GenericGenerator;


import com.bbg.framework.AbstractEntity;


/**

* @author  Rangey

*/

@Entity

@Table(name="BBG_FMS_FILE_INFO")

public class FileInfoPo extends AbstractEntity<String> {

@Transient

private static final long serialVersionUID = -7497235305117364771L;


@Id

@Column(name = "ID", length=36)

@GeneratedValue(generator = "system-uuid")

@GenericGenerator(name = "system-uuid", strategy = "uuid")

private String id;

@Column(length=50)

private String fileName;

@Column

private Long fileSize;

@Column(length=50)

private String moduleName;

@Column(length=10)

private String version;

@Column

private Date createTime;

@Column(length=10)

private String fileType;

@Column

private String remark;

@ElementCollection

@CollectionTable(name = "BBG_FMS_FILE_SLICE", joinColumns = @JoinColumn(name = "FILE_ID"))

@OrderBy("pos")

private List<FileSlice> slices;

@ElementCollection

@CollectionTable(name = "BBG_FMS_FILE_PROP", joinColumns = @JoinColumn(name = "FILE_ID"))

private List<FileProp> props;

public String getId() {

return id;

}


public void setId(String id) {

this.id = id;

}


public String getFileName() {

return fileName;

}


public void setFileName(String fileName) {

this.fileName = fileName;

}


public Long getFileSize() {

return fileSize;

}


public void setFileSize(Long fileSize) {

this.fileSize = fileSize;

}


public String getModuleName() {

return moduleName;

}


public void setModuleName(String moduleName) {

this.moduleName = moduleName;

}


public String getVersion() {

return version;

}


public void setVersion(String version) {

this.version = version;

}


public Date getCreateTime() {

return createTime;

}


public void setCreateTime(Date createTime) {

this.createTime = createTime;

}


public String getFileType() {

return fileType;

}


public void setFileType(String fileType) {

this.fileType = fileType;

}


public String getRemark() {

return remark;

}


public void setRemark(String remark) {

this.remark = remark;

}


public List<FileSlice> getSlices() {

return slices;

}


public void setSlices(List<FileSlice> slices) {

this.slices = slices;

}


public List<FileProp> getProps() {

return props;

}


public void setProps(List<FileProp> props) {

this.props = props;

}


@Override

public String getObjectId() {

return id;

}


}


package com.bbg.fms.model;


import javax.persistence.Column;

import javax.persistence.Embeddable;


/**

 *

 * @author Rangey

 * @version 1.0

 * 

 */

@Embeddable

public class FileSlice {

@Column(length=21800)

private String data;

@Column

private int seqNo;


public String getData() {

return data;

}


public void setData(String data) {

this.data = data;

}


public int getSeqNo() {

return seqNo;

}


public void setSeqNo(int seqNo) {

this.seqNo = seqNo;

}

}



package com.bbg.fms.model;


import javax.persistence.Column;

import javax.persistence.Embeddable;


/**

 *

 * @author Rangey

 * @version 1.0

 * 

 */

@Embeddable

public class FileProp {

@Column

private String keyword;


public String getKeyword() {

return keyword;

}


public void setKeyword(String keyword) {

this.keyword = keyword;

}

}


转载于:https://my.oschina.net/chaenomeles/blog/526507

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值