首页 > 数据库技术 > 详细

hibernate+mysql 自动生成数据库问题

时间:2015-10-28 17:12:41      阅读:413      评论:0      收藏:0      [点我收藏+]

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 }
View Code

解决方法:

http://blog.csdn.net/mlx212/article/details/23828151

或都改为小写,重新生成!

hibernate+mysql 自动生成数据库问题

原文:http://www.cnblogs.com/zhaochunjie/p/4917758.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!