第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定

數(shù)據(jù)庫(kù)的IdType類型為None,但是插入數(shù)據(jù)測(cè)試自動(dòng)填充create_time的時(shí)候報(bào)id沒(méi)有default value的異常,之前插入是ok的

之前插入數(shù)據(jù)的時(shí)候是ok的,但是今天不知道什么原因報(bào)錯(cuò)

http://img1.sycdn.imooc.com//5fe5be720001c43a07300424.jpg



http://img1.sycdn.imooc.com//5fe5bf5600016d9504920229.jpg



org.springframework.dao.DataIntegrityViolationException:?
###?Error?updating?database.??Cause:?java.sql.SQLException:?Field?'user_id'?doesn't?have?a?default?value
###?The?error?may?exist?in?com/d/dao/UserMapper.java?(best?guess)
###?The?error?may?involve?com.d.dao.UserMapper.insert-Inline
###?The?error?occurred?while?setting?parameters
###?SQL:?INSERT?INTO?user??(?name,?age,?email,??create_time?)??VALUES??(??,??,??,????)
###?Cause:?java.sql.SQLException:?Field?'user_id'?doesn't?have?a?default?value
;?Field?'user_id'?doesn't?have?a?default?value;?nested?exception?is?java.sql.SQLException:?Field?'user_id'?doesn't?have?a?default?value
at?org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:246)
at?org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:72)
at?org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:73)
at?org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:446)
at?com.sun.proxy.$Proxy67.insert(Unknown?Source)
at?org.mybatis.spring.SqlSessionTemplate.insert(SqlSessionTemplate.java:278)
at?com.baomidou.mybatisplus.core.override.MybatisMapperMethod.execute(MybatisMapperMethod.java:58)
at?com.baomidou.mybatisplus.core.override.MybatisMapperProxy.invoke(MybatisMapperProxy.java:62)
at?com.sun.proxy.$Proxy68.insert(Unknown?Source)
at?sun.reflect.NativeMethodAccessorImpl.invoke0(Native?Method)
at?sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at?sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at?java.lang.reflect.Method.invoke(Method.java:498)
at?org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:343)
at?org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:198)
at?org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
at?org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:139)
at?org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
at?org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:212)
at?com.sun.proxy.$Proxy70.insert(Unknown?Source)
at?com.mp.FillTest.test1(FillTest.java:31)
at?sun.reflect.NativeMethodAccessorImpl.invoke0(Native?Method)
at?sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at?sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at?java.lang.reflect.Method.invoke(Method.java:498)
at?org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at?org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at?org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at?org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at?org.springframework.test.context.junit4.statements.RunBeforeTestExecutionCallbacks.evaluate(RunBeforeTestExecutionCallbacks.java:74)
at?org.springframework.test.context.junit4.statements.RunAfterTestExecutionCallbacks.evaluate(RunAfterTestExecutionCallbacks.java:84)
at?org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:75)
at?org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:86)
at?org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:84)
at?org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at?org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:251)
at?org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:97)
at?org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at?org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at?org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at?org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at?org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at?org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
at?org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70)
at?org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at?org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:190)
at?org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at?com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
at?com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:33)
at?com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:230)
at?com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:58)
Caused?by:?java.sql.SQLException:?Field?'user_id'?doesn't?have?a?default?value
at?com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:129)
at?com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:97)
at?com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:122)
at?com.mysql.cj.jdbc.ClientPreparedStatement.executeInternal(ClientPreparedStatement.java:970)
at?com.mysql.cj.jdbc.ClientPreparedStatement.execute(ClientPreparedStatement.java:387)
at?com.zaxxer.hikari.pool.ProxyPreparedStatement.execute(ProxyPreparedStatement.java:44)
at?com.zaxxer.hikari.pool.HikariProxyPreparedStatement.execute(HikariProxyPreparedStatement.java)
at?sun.reflect.NativeMethodAccessorImpl.invoke0(Native?Method)
at?sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at?sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at?java.lang.reflect.Method.invoke(Method.java:498)
at?org.apache.ibatis.logging.jdbc.PreparedStatementLogger.invoke(PreparedStatementLogger.java:59)
at?com.sun.proxy.$Proxy90.execute(Unknown?Source)
at?org.apache.ibatis.executor.statement.PreparedStatementHandler.update(PreparedStatementHandler.java:47)
at?org.apache.ibatis.executor.statement.RoutingStatementHandler.update(RoutingStatementHandler.java:74)
at?sun.reflect.NativeMethodAccessorImpl.invoke0(Native?Method)
at?sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at?sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at?java.lang.reflect.Method.invoke(Method.java:498)
at?org.apache.ibatis.plugin.Plugin.invoke(Plugin.java:63)
at?com.sun.proxy.$Proxy89.update(Unknown?Source)
at?com.baomidou.mybatisplus.core.executor.MybatisSimpleExecutor.doUpdate(MybatisSimpleExecutor.java:54)
at?org.apache.ibatis.executor.BaseExecutor.update(BaseExecutor.java:117)
at?org.apache.ibatis.executor.CachingExecutor.update(CachingExecutor.java:76)
at?org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:197)
at?org.apache.ibatis.session.defaults.DefaultSqlSession.insert(DefaultSqlSession.java:184)
at?sun.reflect.NativeMethodAccessorImpl.invoke0(Native?Method)
at?sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at?sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at?java.lang.reflect.Method.invoke(Method.java:498)
at?org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:433)
...?47?more


正在回答

1 回答

請(qǐng)問(wèn)你數(shù)據(jù)庫(kù)的主鍵,沒(méi)有設(shè)置自增,是由自己維護(hù)是嗎?注釋上說(shuō)“該類型為未設(shè)置主鍵類型(注解里等于跟隨全局,全局里約等于 INPUT)”,是不是全局的主鍵策略配置的是由自己維護(hù)主鍵,如果是這樣,自己生成主鍵,設(shè)置上就可以了。

0 回復(fù) 有任何疑惑可以回復(fù)我~
#1

慕田峪6411769 提問(wèn)者

id為主鍵 沒(méi)有設(shè)置自增,但是所以如果只加上@TableId注解而要使mp默認(rèn)的雪花算法生效的話主鍵要該如何設(shè)置呢
2020-12-30 回復(fù) 有任何疑惑可以回復(fù)我~
#2

老猿 回復(fù) 慕田峪6411769 提問(wèn)者

你只在主鍵上增加@TableId注解,這個(gè)注解不加屬性試試。
2020-12-30 回復(fù) 有任何疑惑可以回復(fù)我~

舉報(bào)

0/150
提交
取消

數(shù)據(jù)庫(kù)的IdType類型為None,但是插入數(shù)據(jù)測(cè)試自動(dòng)填充create_time的時(shí)候報(bào)id沒(méi)有default value的異常,之前插入是ok的

我要回答 關(guān)注問(wèn)題
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)