Hibernate 注解视图能和注解表一样的注解吗
1个回答
2016-11-18 · 做真实的自己 用良心做教育
千锋教育
千锋教育专注HTML5大前端、JavaEE、Python、人工智能、UI&UE、云计算、全栈软件测试、大数据、物联网+嵌入式、Unity游戏开发、网络安全、互联网营销、Go语言等培训教育。
向TA提问
关注
展开全部
注释是可以的.至少我们oralce数据库是没有问题,mysql没有试过,不过应该错不多.jboss上没有运行过,tomcat上运行是没有问题.
注释好像没有听说过要配置persistence.xml文件.
@Entity
@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
@org.hibernate.annotations.Entity
@Table(name = "ECP_V_PROJECT_COUNT")
public class ProjectCountView implements GpcBaseObject{
/** serialVersionUID */
private static final long serialVersionUID = 1L;
@Id
@Column(name = "projId", length = 36)
private String objId; //主键
@Column(name = "subProjectC")
private BigDecimal subProjectC = new BigDecimal("0"); //分包数目
@Column(name = "signUpC")
private BigDecimal signUpC = new BigDecimal("0");; //参与供应商数目
@Column(name = "signUpValidC")
private BigDecimal signUpValidC = new BigDecimal("0");; //有效参与供应商数目
@Column(name = "bidC")
private BigDecimal bidC = new BigDecimal("0");; //参与投标供应商数目
@Column(name = "bidValidC")
private BigDecimal bidValidC = new BigDecimal("0");; //有效参与投标供应商数目
@Column(name = "winnerC")
private BigDecimal winnerC = new BigDecimal("0");; //中标供应商数目
public String getObjId() {
return objId;
}
public void setObjId(String objId) {
this.objId = objId;
}
public BigDecimal getSubProjectC() {
return this.subProjectC;
}
public void setSubProjectC(BigDecimal subProjectC) {
this.subProjectC = subProjectC;
}
public BigDecimal getSignUpC() {
return this.signUpC;
}
public void setSignUpC(BigDecimal signUpC) {
this.signUpC = signUpC;
}
public BigDecimal getSignUpValidC() {
return this.signUpValidC;
}
public void setSignUpValidC(BigDecimal signUpValidC) {
this.signUpValidC = signUpValidC;
}
public BigDecimal getBidC() {
return this.bidC;
}
public void setBidC(BigDecimal bidC) {
this.bidC = bidC;
}
public BigDecimal getBidValidC() {
return this.bidValidC;
}
public void setBidValidC(BigDecimal bidValidC) {
this.bidValidC = bidValidC;
}
public BigDecimal getWinnerC() {
return this.winnerC;
}
public void setWinnerC(BigDecimal winnerC) {
this.winnerC = winnerC;
}
public Date getCreateTime() {
// TODO Auto-generated method stub
return null;
}
public void setCreateTime(Date arg0) {
// TODO Auto-generated method stub
}
}
CREATE OR REPLACE VIEW ECP_V_PROJECT_COUNT AS
SELECT proj.tenderid as projId,(
SELECT COUNT(pack.tenderid) FROM ECP_Tender_Project pack WHERE pack.parent_id = proj.tenderid
) subProjectC,(
SELECT COUNT(apply.applyid) FROM ECP_TENDER_APPLY_REC apply WHERE apply.tenderid = proj.tenderid
) signUpC ,(
SELECT COUNT(apply1.Applyid) FROM ECP_TENDER_APPLY_REC apply1 WHERE apply1.tenderid = proj.tenderid AND apply1.Auditstatus='01'
)signUpValidC,(
SELECT COUNT(bid.bid_id) FROM ECP_BID bid WHERE bid.proj_id = proj.tenderid
) bidC,(
SELECT COUNT(bid1.bid_id) FROM ECP_BID bid1 WHERE bid1.proj_id = proj.tenderid
)bidValidC ,(
SELECT COUNT(winner.buy_w_id) FROM ECP_BUY_WINNER winner
LEFT JOIN ECP_BUYRESULT buyResult on buyResult.BUYR_ID = winner.BUYR_ID
WHERE winner.RESULT_TYPE = '01' AND buyResult.PROJ_ID = proj.tenderid
)winnerC
FROM ECP_Tender_Project proj WHERE proj.parent_id is null;
注释好像没有听说过要配置persistence.xml文件.
@Entity
@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
@org.hibernate.annotations.Entity
@Table(name = "ECP_V_PROJECT_COUNT")
public class ProjectCountView implements GpcBaseObject{
/** serialVersionUID */
private static final long serialVersionUID = 1L;
@Id
@Column(name = "projId", length = 36)
private String objId; //主键
@Column(name = "subProjectC")
private BigDecimal subProjectC = new BigDecimal("0"); //分包数目
@Column(name = "signUpC")
private BigDecimal signUpC = new BigDecimal("0");; //参与供应商数目
@Column(name = "signUpValidC")
private BigDecimal signUpValidC = new BigDecimal("0");; //有效参与供应商数目
@Column(name = "bidC")
private BigDecimal bidC = new BigDecimal("0");; //参与投标供应商数目
@Column(name = "bidValidC")
private BigDecimal bidValidC = new BigDecimal("0");; //有效参与投标供应商数目
@Column(name = "winnerC")
private BigDecimal winnerC = new BigDecimal("0");; //中标供应商数目
public String getObjId() {
return objId;
}
public void setObjId(String objId) {
this.objId = objId;
}
public BigDecimal getSubProjectC() {
return this.subProjectC;
}
public void setSubProjectC(BigDecimal subProjectC) {
this.subProjectC = subProjectC;
}
public BigDecimal getSignUpC() {
return this.signUpC;
}
public void setSignUpC(BigDecimal signUpC) {
this.signUpC = signUpC;
}
public BigDecimal getSignUpValidC() {
return this.signUpValidC;
}
public void setSignUpValidC(BigDecimal signUpValidC) {
this.signUpValidC = signUpValidC;
}
public BigDecimal getBidC() {
return this.bidC;
}
public void setBidC(BigDecimal bidC) {
this.bidC = bidC;
}
public BigDecimal getBidValidC() {
return this.bidValidC;
}
public void setBidValidC(BigDecimal bidValidC) {
this.bidValidC = bidValidC;
}
public BigDecimal getWinnerC() {
return this.winnerC;
}
public void setWinnerC(BigDecimal winnerC) {
this.winnerC = winnerC;
}
public Date getCreateTime() {
// TODO Auto-generated method stub
return null;
}
public void setCreateTime(Date arg0) {
// TODO Auto-generated method stub
}
}
CREATE OR REPLACE VIEW ECP_V_PROJECT_COUNT AS
SELECT proj.tenderid as projId,(
SELECT COUNT(pack.tenderid) FROM ECP_Tender_Project pack WHERE pack.parent_id = proj.tenderid
) subProjectC,(
SELECT COUNT(apply.applyid) FROM ECP_TENDER_APPLY_REC apply WHERE apply.tenderid = proj.tenderid
) signUpC ,(
SELECT COUNT(apply1.Applyid) FROM ECP_TENDER_APPLY_REC apply1 WHERE apply1.tenderid = proj.tenderid AND apply1.Auditstatus='01'
)signUpValidC,(
SELECT COUNT(bid.bid_id) FROM ECP_BID bid WHERE bid.proj_id = proj.tenderid
) bidC,(
SELECT COUNT(bid1.bid_id) FROM ECP_BID bid1 WHERE bid1.proj_id = proj.tenderid
)bidValidC ,(
SELECT COUNT(winner.buy_w_id) FROM ECP_BUY_WINNER winner
LEFT JOIN ECP_BUYRESULT buyResult on buyResult.BUYR_ID = winner.BUYR_ID
WHERE winner.RESULT_TYPE = '01' AND buyResult.PROJ_ID = proj.tenderid
)winnerC
FROM ECP_Tender_Project proj WHERE proj.parent_id is null;
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询