Why jooq is not returning when mysql table has a unique index? -
mysql table
create table `user` ( `id` int(10) unsigned not null auto_increment, `telphone` varchar(32) not null, `name` varchar(64) not null default '', `password` varchar(64) not null default '', `balance` int(11) not null default '0', `user_type` int(2) not null, primary key (`id`), unique key `phone_index` (`telphone`) using btree ) engine=innodb auto_increment=28 default charset=utf8;
and code write :
@service public class commondao { @resource private dslcontext jooqcontext; public <r extends record> r insertandget(table<r> table, r r, field<?>... f) { return jooqcontext.insertinto(table).set(r).returning(f).fetchone(); } }
it return null when use insert , get, , data insert database. when delete unique key in mysql, works fine.
Comments
Post a Comment