/** * Copyright (c)2010-2011 Enterprise Website Content Management System(EWCMS), All rights reserved. * EWCMS PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. * http://www.ewcms.com */ package com.ewcms.content.document.model; import java.io.Serializable; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.SequenceGenerator; import javax.persistence.Table; /** * 文章内容 * * <ul> * <li>id:编号</li> * <li>detail:内容</li> * <li>page:页数</li> * </ul> * * @author 吴智俊 */ @Entity @Table(name = "content_content") @SequenceGenerator(name = "seq_content_content", sequenceName = "seq_content_content_id", allocationSize = 1) public class Content implements Serializable { private static final long serialVersionUID = -4505457961298597538L; @Id @GeneratedValue(generator = "seq_content_content", strategy = GenerationType.SEQUENCE) @Column(name = "id") private Integer id; @Column(name = "detail") private byte[] detail; @Column(name = "page", nullable = false) private Integer page; public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public String getDetail() { String detailString = ""; try { detailString = new String(detail, "UTF-8"); } catch (Exception e) { } return detailString; } public void setDetail(String detail) { byte[] detailByte = null; try { detailByte = detail.getBytes("UTF-8"); } catch (Exception e) { } this.detail = detailByte; } public Integer getPage() { return page; } public void setPage(Integer page) { this.page = page; } @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((id == null) ? 0 : id.hashCode()); return result; } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Content other = (Content) obj; if (id == null) { if (other.id != null) return false; } else if (!id.equals(other.id)) return false; return true; } }