Org.hibernate.id.IdentifierGenerationException:ids for this class must is manually assigned before calling Save ()

Source: Internet
Author: User

Org.hibernate.id.IdentifierGenerationException:ids for this class must is manually assigned before calling save () : Com.zh.hibernate.subclass.Person
At Org.hibernate.id.Assigned.generate (assigned.java:52)
At Org.hibernate.event.internal.AbstractSaveEventListener.saveWithGeneratedId (Abstractsaveeventlistener.java : 117)
At Org.hibernate.event.internal.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId ( defaultsaveorupdateeventlistener.java:206)
At Org.hibernate.event.internal.DefaultSaveEventListener.saveWithGeneratedOrRequestedId ( DEFAULTSAVEEVENTLISTENER.JAVA:55)
At Org.hibernate.event.internal.DefaultSaveOrUpdateEventListener.entityIsTransient ( defaultsaveorupdateeventlistener.java:191)
At Org.hibernate.event.internal.DefaultSaveEventListener.performSaveOrUpdate (defaultsaveeventlistener.java:49)
At Org.hibernate.event.internal.DefaultSaveOrUpdateEventListener.onSaveOrUpdate ( DEFAULTSAVEORUPDATEEVENTLISTENER.JAVA:90)
At Org.hibernate.internal.SessionImpl.fireSave (sessionimpl.java:764)
At Org.hibernate.internal.SessionImpl.save (sessionimpl.java:756)
At Org.hibernate.internal.SessionImpl.save (sessionimpl.java:752)
At Com.zh.hibernate.subclass.SubclassTest.testSave (subclasstest.java:26)
At Sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
At Sun.reflect.NativeMethodAccessorImpl.invoke (nativemethodaccessorimpl.java:57)
At Sun.reflect.DelegatingMethodAccessorImpl.invoke (delegatingmethodaccessorimpl.java:43)
At Java.lang.reflect.Method.invoke (method.java:606)
At Org.junit.runners.model.frameworkmethod$1.runreflectivecall (frameworkmethod.java:47)
At Org.junit.internal.runners.model.ReflectiveCallable.run (reflectivecallable.java:12)
At org.junit.runners.model.FrameworkMethod.invokeExplosively (frameworkmethod.java:44)
At Org.junit.internal.runners.statements.InvokeMethod.evaluate (invokemethod.java:17)
At Org.junit.runners.ParentRunner.runLeaf (parentrunner.java:271)
At Org.junit.runners.BlockJUnit4ClassRunner.runChild (blockjunit4classrunner.java:70)
At Org.junit.runners.BlockJUnit4ClassRunner.runChild (blockjunit4classrunner.java:50)
At Org.junit.runners.parentrunner$3.run (parentrunner.java:238)
At Org.junit.runners.parentrunner$1.schedule (parentrunner.java:63)
At Org.junit.runners.ParentRunner.runChildren (parentrunner.java:236)
At org.junit.runners.parentrunner.access$000 (parentrunner.java:53)
At Org.junit.runners.parentrunner$2.evaluate (parentrunner.java:229)
At Org.junit.runners.ParentRunner.run (parentrunner.java:309)
At Org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run (junit4testreference.java:50)
At Org.eclipse.jdt.internal.junit.runner.TestExecution.run (testexecution.java:38)
At Org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests (remotetestrunner.java:459)
At Org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests (remotetestrunner.java:675)
At Org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run (remotetestrunner.java:382)
At Org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main (remotetestrunner.java:192)

Cause of error: In the mapping file, the ID is set to the category assigned, which does not conform to the settings of my database MySQL itself.

Change the error:

Now that I have changed its properties to native, I can see that there are no other causes of such errors at this time. After the encounter will be updated in time

Org.hibernate.id.IdentifierGenerationException:ids for this class must is manually assigned before calling Save ()

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.