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 zcj 18 * 19 * @Time 2015-8-17 14:21 20 */ 21 @Entity 22 @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 @Lob 36 @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
或都改为小写,重新生成!
原文:http://www.cnblogs.com/zhaochunjie/p/4917758.html