JPA,EclipseLink和区分大小写的mysql问题 [英] Problem with JPA, EclipseLink and case sensitive mysql

查看:152
本文介绍了JPA,EclipseLink和区分大小写的mysql问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的应用程序在Windows环境中运行良好,但是当我尝试在Linux服务器上进行测试时,生成的JPA EclipseLink sql出现了问题. 我用小写创建了所有表,但是当我查看日志时,看到的都是大写:

My application is working fine in a Windows environment, but when I'm trying to test in a linux server, I have a problem with the JPA EclipseLink sql generated. I created all my tables in lower case, but when I look in the logs, I see something like that, all in upper case:

INSERT INTO PFC(ID, ALUMN,PROPOSED_ID) VALUES (?, ?, ?)

与其他这样的字母(序列)以小写字母混合:

mixed with others like this (sequences) in lower case:

INSERT INTO buzonmensajes (mensajeid, buzonid) VALUES (?, ?)
        bind => [27, 1]

当然,一切都会出错,服务器找不到大写表,等等.

and of course, everything goes wrong, server didn't find the uppercase tables, etc..

我们使用orm.xml定义所有数据库操作(查询,实体等)以及所有小写的内容...

We use orm.xml to define all the database actions (queries,entities, etc..) and everything it's in lowercase...

我知道有一个Mysql参数可以更改这些行为,但是很遗憾,我不允许更改它. 我的问题是我需要告诉JPA创建所有查询,并使用小写的表名插入statmets

I know that there are a Mysql paramater to change these behaviour, but unfortunately I'm not allowed to change it. My problem is that I need to tell to JPA to create all the querys and insert statmets with the table name in lower case

推荐答案

该问题很可能发生,因为您允许EclipseLink缺省使用某些名称.如果您使用数据库的大小写来指定名称,则EclipseLink默认情况下将使用这些大小写.

The issue is likely occurring because you are allowing EclipseLink to default some of the names. If you specify the names using the case of your database EclipseLink should use those cases by default.

如果发现它不起作用,则可以始终使用带'\''模式的定界标识符来强制区分大小写:@Table("\"pfc\""),但这不是必需的.

If you find that is not working you can always enforce case by using delimited identifiers using the '\"' pattern : @Table("\"pfc\"") but this should not be required.

您使用的是什么版本的EclipseLink?

What version of EclipseLink are you using?

这篇关于JPA,EclipseLink和区分大小写的mysql问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆