字段“类别"没有默认值 [英] Field 'class' doesn't have a default value
问题描述
在我们的应用中,我有一个描述人的课程(眼睛和头发的颜色,身高等).完成注册形式后,我单击提交"按钮,并引发异常:
In our app, I have a class describing a person (eye and hair colour, height, etc). Once the form of registering is fulfilled, I click in the submit button, and an exception is thrown:
Class: java.sql.SQLException
Message: Field 'class' doesn't have a default value
我为此感到头疼,因为出于明显的原因(没有保留的字眼),没有一个类具有名为class的字段,并且在数据库中也没有名为class的列.
I am scratching my head about this, because none of the classes have a field named class, for obvious reasons (it's a reserved word), and in the database there is no column named class, neither.
知道为什么会这样吗?以及如何解决?
Any idea why this happens? And how to fix it?
我尝试过:
classThrowingExceptionInstance.class=ClassThrowingException
现在它说无法设置只读属性:类ClassThrowingException的类
And now it says Cannot set readonly property: class for class ClassThrowingException
推荐答案
似乎是MySQL错误1364-消息:字段'%s'没有默认值.
It seems that it is MySQL error 1364 - Message: Field '%s' doesn't have a default value.
检查您修改的表.是否有没有默认值的字段?如果它们未发布这些字段值,还请分析INSERT和UPDATE语句.
Check the table which you modify. Are there any fields without default values? Also analyze INSERT and UPDATE statements if they do not post these field values.
要纠正此错误,请执行以下操作:
To fix this error:
- 修改表格-为所需字段设置默认值
或
- 将具体值传递给INSERT/UPDATE语句中的这些字段.
这篇关于字段“类别"没有默认值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!