我想使用 netbean 6.5、glassfish V 2 制作 Restful - Web 服务,并且我已经制作了表以及表之间的关系。但是当我想测试restful Webservice时,它会显示一些表格
HTTP Status 500 -
type Exception report
message
descriptionThe server encountered an internal error () that prevented it from fulfilling this request.
exception
Exception [TOPLINK-4002] (Oracle TopLink Essentials - 2.0.1 (Build b04-fcs (04/11/2008))): oracle.toplink.essentials.exceptions.DatabaseException
Internal Exception: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown column 'E' in 'field list'
Error Code: 1054
Call: SELECT Id, MobileNumber, Country, First_Name, E-mail, Address, Identity, Zip, Last_name, City, State, Position FROM employee_table WHERE (Id = ?)
bind => [1]
Query: ReadObjectQuery(ws.EmployeeTable)
note The full stack traces of the exception and its root causes are available in the Sun Java System Application Server 9.1_02 logs.
但有些表正在工作。有人知道导致此问题的原因以及如何处理此问题吗?谢谢。
感谢安德鲁·梅迪科和吉姆·费兰斯
我把我所有的电子邮件都改成了电子邮件。我不会忘记不再在数据库中添加“-”。谢谢
最佳答案
您需要引用“电子邮件”列名称,以便 SQL 解析器接受它。不带引号/转义的破折号是 SQL 中的减法运算符,因此不带引号的“E-mail”意味着您向 SQL 服务器询问名为“E”和“mail”的列相减的结果。
正确的 SQL 是:
SELECT Id, MobileNumber, Country, First_Name, `E-mail`, Address, Identity, Zip, Last_name, City, State, Position FROM employee_table WHERE (Id = ?)
关于java - HTTP 状态 500,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2011010/