Hibernate Entity类
表名注解大写时,在windows下MySQL自动生成的表都为小写(不区分大小写),在linux下mysql自动生成区分大小写。导致数据库问题。
原因(window下mysql不区分大小写,hibernate生成时全部生成小写,linux下生成时,按照注解大小写生成)
1 package com.pera.report.designer.data; 2 3 import java.sql.Clob; 4 5 import javax.persistence.Basic; 6 import javax.persistence.Column; 7 import javax.persistence.Entity; 8 import javax.persistence.FetchType; 9 import javax.persistence.Lob;10 import javax.persistence.Table;11 12 import com.pera.maframework.core.common.entity.IdEntity;13 14 /**15 * xml保存数据库16 * 17 * @author zcj18 * 19 * @Time 2015-8-17 14:2120 */21 @Entity22 @Table(name = "qreport_Xml")23 public class ReportXml extends IdEntity implements java.io.Serializable {24 /**25 * 26 */27 PRivate static final long serialVersionUID = 8362245934322337549L;28 29 private Clob reportXml;30 31 private String reportName;32 33 private String reportMemo;34 35 @Lob36 @Basic(fetch = FetchType.EAGER)37 @Column(name = "reportXml", columnDefinition = "TEXT", nullable = true)38 public Clob getReportXml() {39 return reportXml;40 }41 public void setReportXml(Clob reportXml) {42 this.reportXml = reportXml;43 }44 45 @Column(name = "reportName")46 public String getReportName() {47 return reportName;48 }49 public void setReportName(String reportName) {50 this.reportName = reportName;51 }52 53 @Column(name = "reportMemo")54 public String getReportMemo() {55 return reportMemo;56 }57 public void setReportMemo(String reportMemo) {58 this.reportMemo = reportMemo;59 }60 }
解决方法:
http://blog.csdn.net/mlx212/article/details/23828151
或都改为小写,重新生成!
新闻热点
疑难解答