具有特殊字符的列注释(Column annotation with special characters)

编程入门 行业动态 更新时间:2024-10-28 04:29:28
具有特殊字符的列注释(Column annotation with special characters)

我将通过兼容JPA的ORM读取MS-ACCESS 97数据库。 重点是数据库中的列名具有特殊字符:

@Column(name="FechPró") Date nextDate;

在执行时我得到了这个

Caused by: java.sql.SQLException: Column not found at sun.jdbc.odbc.JdbcOdbcResultSet.findColumn(JdbcOdbcResultSet.java:1849) at sun.jdbc.odbc.JdbcOdbcResultSet.getObject(JdbcOdbcResultSet.java:1742)

可能我必须做这样的事情

@Column(name=new String("FechPró".getBytes("ISO-8859-1")))

但这不会编译。

I'm going to read a MS-ACCESS 97 Database thru a JPA compatible ORM. The point is the column name in the database has special characters:

@Column(name="FechPró") Date nextDate;

And at execution I get this

Caused by: java.sql.SQLException: Column not found at sun.jdbc.odbc.JdbcOdbcResultSet.findColumn(JdbcOdbcResultSet.java:1849) at sun.jdbc.odbc.JdbcOdbcResultSet.getObject(JdbcOdbcResultSet.java:1742)

Probably I have to do something like this

@Column(name=new String("FechPró".getBytes("ISO-8859-1")))

But this won't compile.

最满意答案

也许我说的很明显,但是......你试过传递compilier的编码参数吗? 喜欢这篇文章?

也许我再次说明这个选项:如果您使用像eclipse这样的IDE,您可以搜索首选项来为您的项目设置编码。

Maybe I'm stating the obvious but... did you try passing the compilier the encoding parameter? like in this article?

And maybe I'm again stating the option: if you use an IDE like eclipse you can search through the preferences to set up an encoding for your project.

更多推荐

本文发布于:2023-08-04 10:50:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1415366.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:注释   特殊字符   Column   characters   special

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!