mysql field id doesnt have a default value_mysql - Field 'id' doesn't have a default value? - Stack ...

本文讲述了作者在使用InnoDB引擎和latin1字符集时遇到的字段名称冲突问题,通过修改表结构并重新创建,解决了Mobno字段的未知列错误。核心在于理解字符集设置对字段映射的影响,并提示了可能的缓存问题。

For me the issue got fixed when I changed

to

in my Person.hbm.xml.

after that I re-encountered that same error for an another field(mobno). I tried restarting my IDE, recreating the database with previous back issue got eventually fixed when I re-create my tables using (without ENGINE=InnoDB DEFAULT CHARSET=latin1; and removing underscores in the field name)

CREATE TABLE `tbl_customers` (

`pid` bigint(20) NOT NULL,

`title` varchar(4) NOT NULL,

`dob` varchar(10) NOT NULL,

`address` varchar(100) NOT NULL,

`country` varchar(4) DEFAULT NULL,

`hometp` int(12) NOT NULL,

`worktp` int(12) NOT NULL,

`mobno` varchar(12) NOT NULL,

`btcfrom` varchar(8) NOT NULL,

`btcto` varchar(8) NOT NULL,

`mmname` varchar(20) NOT NULL

)

instead of

CREATE TABLE `tbl_person` (

`person_id` bigint(20) NOT NULL,

`person_nic` int(10) NOT NULL,

`first_name` varchar(20) NOT NULL,

`sur_name` varchar(20) NOT NULL,

`person_email` varchar(20) NOT NULL,

`person_password` varchar(512) NOT NULL,

`mobno` varchar(10) NOT NULL DEFAULT '1',

`role` varchar(10) NOT NULL,

`verified` int(1) DEFAULT NULL

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

I probably think this due to using ENGINE=InnoDB DEFAULT CHARSET=latin1; , because I once got the error org.hibernate.engine.jdbc.spi.SqlExceptionHelper - Unknown column 'mob_no' in 'field list' even though it was my previous column name, which even do not exist in my current table. Even after backing up the database(with modified column name, using InnoDB engine) I still got that same error with old field name. This probably due to caching in that Engine.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值