Three exceptions in hibernate

Source: Internet
Author: User

Exception 1:

Java. Lang. exceptionininitializererror

Atcom. hibernate. Service. userserviceimpl. <init> (userserviceimpl. Java: 11)

Atcom. hibernate. JUnit. usertest. <init> (usertest. Java: 12)

Atsun. Reflect. nativeconstructoraccessorimpl. newinstance0 (native method)

Atsun. Reflect. nativeconstructoraccessorimpl. newinstance (nativeconstructoraccessorimpl. Java: 39)

Atsun. Reflect. delegatingconstruct%cessorimpl. newinstance (delegatingconstruct%cessorimpl. Java: 27)

Atjava. Lang. Reflect. constructor. newinstance (constructor. Java: 513)

Atorg. JUnit. Runners. blockjunit4classrunner. createtest (blockjunit4classrunner. Java: 202)

Atorg. JUnit. Runners. blockjunit4classrunner $1. runreflectivecall (blockjunit4classrunner. Java: 251)

Atorg. JUnit. Internal. Runners. model. reflectivecallable. Run (reflectivecallable. Java: 15)

Atorg. JUnit. Runners. blockjunit4classrunner. methodblock (blockjunit4classrunner. Java: 248)

Atorg. JUnit. Runners. blockjunit4classrunner. runchild (blockjunit4classrunner. Java: 76)

Atorg. JUnit. Runners. blockjunit4classrunner. runchild (blockjunit4classrunner. Java: 50)

Atorg. JUnit. Runners. parentrunner $ 3.run( parentrunner. Java: 193)

Atorg. JUnit. Runners. parentrunner $1. Schedule (parentrunner. Java: 52)

Atorg. JUnit. Runners. parentrunner. runchildren (parentrunner. Java: 191)

Atorg. JUnit. Runners. parentrunner. Access $000 (parentrunner. Java: 42)

Atorg. JUnit. Runners. parentrunner $2. Evaluate (parentrunner. Java: 184)

Atorg. JUnit. Runners. parentrunner. Run (parentrunner. Java: 236)

Atorg. Eclipse. jdt. Internal. junit4.runner. junit4testreference. Run (junit4testreference. Java: 49)

Atorg. Eclipse. jdt. Internal. JUnit. Runner. testexecution. Run (testexecution. Java: 38)

Atorg. Eclipse. jdt. Internal. JUnit. Runner. remotetestrunner. runtests (remotetestrunner. Java: 467)

Atorg. Eclipse. jdt. Internal. JUnit. Runner. remotetestrunner. runtests (remotetestrunner. Java: 683)

Atorg. Eclipse. jdt. Internal. JUnit. Runner. remotetestrunner. Run (remotetestrunner. Java: 390)

Atorg. Eclipse. jdt. Internal. JUnit. Runner. remotetestrunner. Main (remotetestrunner. Java: 197)

Caused by: org. hibernate. hibernateexception: Missing column: ABC in hibernate. User

Atorg. hibernate. Mapping. Table. validatecolumns (table. Java: 276)

Atorg. hibernate. cfg. configuration. validateschema (configuration. Java: 1343)

Atorg. hibernate. tool. hbm2ddl. schemavalidator. Validate (schemavalidator. Java: 139)

Atorg. hibernate. impl. sessionfactoryimpl. <init> (sessionfactoryimpl. Java: 378)

Atorg. hibernate. cfg. configuration. buildsessionfactory (configuration. Java: 1872)

Atcom. hibernate. Dao. userdaoimpl. <clinit> (userdaoimpl. Java: 23)

... 24 more

Cause of exception:

Verify with validate, add attributes and the corresponding set and get methods for existing tables, and declare them in the ing file, however, due to a change in the table structure, all exceptions are thrown.

 

 

Exception 2:

Java. Lang. exceptionininitializererror

Atcom. hibernate. Service. userserviceimpl. <init> (userserviceimpl. Java: 11)

Atcom. hibernate. JUnit. usertest. <init> (usertest. Java: 12)

Atsun. Reflect. nativeconstructoraccessorimpl. newinstance0 (native method)

Atsun. Reflect. nativeconstructoraccessorimpl. newinstance (nativeconstructoraccessorimpl. Java: 39)

Atsun. Reflect. delegatingconstruct%cessorimpl. newinstance (delegatingconstruct%cessorimpl. Java: 27)

Atjava. Lang. Reflect. constructor. newinstance (constructor. Java: 513)

Atorg. JUnit. Runners. blockjunit4classrunner. createtest (blockjunit4classrunner. Java: 202)

Atorg. JUnit. Runners. blockjunit4classrunner $1. runreflectivecall (blockjunit4classrunner. Java: 251)

Atorg. JUnit. Internal. Runners. model. reflectivecallable. Run (reflectivecallable. Java: 15)

Atorg. JUnit. Runners. blockjunit4classrunner. methodblock (blockjunit4classrunner. Java: 248)

Atorg. JUnit. Runners. blockjunit4classrunner. runchild (blockjunit4classrunner. Java: 76)

Atorg. JUnit. Runners. blockjunit4classrunner. runchild (blockjunit4classrunner. Java: 50)

Atorg. JUnit. Runners. parentrunner $ 3.run( parentrunner. Java: 193)

Atorg. JUnit. Runners. parentrunner $1. Schedule (parentrunner. Java: 52)

Atorg. JUnit. Runners. parentrunner. runchildren (parentrunner. Java: 191)

Atorg. JUnit. Runners. parentrunner. Access $000 (parentrunner. Java: 42)

Atorg. JUnit. Runners. parentrunner $2. Evaluate (parentrunner. Java: 184)

Atorg. JUnit. Runners. parentrunner. Run (parentrunner. Java: 236)

Atorg. Eclipse. jdt. Internal. junit4.runner. junit4testreference. Run (junit4testreference. Java: 49)

Atorg. Eclipse. jdt. Internal. JUnit. Runner. testexecution. Run (testexecution. Java: 38)

Atorg. Eclipse. jdt. Internal. JUnit. Runner. remotetestrunner. runtests (remotetestrunner. Java: 467)

Atorg. Eclipse. jdt. Internal. JUnit. Runner. remotetestrunner. runtests (remotetestrunner. Java: 683)

Atorg. Eclipse. jdt. Internal. JUnit. Runner. remotetestrunner. Run (remotetestrunner. Java: 390)

Atorg. Eclipse. jdt. Internal. JUnit. Runner. remotetestrunner. Main (remotetestrunner. Java: 197)

Caused by: org. hibernate. hibernateexception: Unable to instantiate default tuplizer

[Org. hibernate. tuple. entity. pojoentitytuplizer]

Atorg. hibernate. tuple. entity. entitytuplizerfactory. constructtuplizer (entitytuplizerfactory. Java: 108)

Atorg. hibernate. tuple. entity. entitytuplizerfactory. constructdefaulttuplizer (entitytuplizerfactory. Java: 133)

Atorg. hibernate. tuple. entity. entityentitymodetotuplizermapping. <init> (entityentitymodetotuplizermapping. Java: 80)

Atorg. hibernate. tuple. entity. entitymetamodel. <init> (entitymetamodel. Java: 322)

Atorg. hibernate. persister. entity. abstractentitypersister. <init> (abstractentitypersister. Java: 485)

Atorg. hibernate. persister. entity. singletableentitypersister. <init> (singletableentitypersister. Java: 133)

Atorg. hibernate. persister. persisterfactory. createclasspersister (persisterfactory. Java: 84)

Atorg. hibernate. impl. sessionfactoryimpl. <init> (sessionfactoryimpl. Java: 286)

Atorg. hibernate. cfg. configuration. buildsessionfactory (configuration. Java: 1872)

Atcom. hibernate. Dao. userdaoimpl. <clinit> (userdaoimpl. Java: 23)

... 24 more

Caused by: Java. Lang. Reflect. invocationtargetexception

Atsun. Reflect. nativeconstructoraccessorimpl. newinstance0 (native method)

Atsun. Reflect. nativeconstructoraccessorimpl. newinstance (nativeconstructoraccessorimpl. Java: 39)

Atsun. Reflect. delegatingconstruct%cessorimpl. newinstance (delegatingconstruct%cessorimpl. Java: 27)

Atjava. Lang. Reflect. constructor. newinstance (constructor. Java: 513)

Atorg. hibernate. tuple. entity. entitytuplizerfactory. constructtuplizer (entitytuplizerfactory. Java: 105)

... 33 more

Caused by: org. hibernate. propertynotfoundexception: cocould not find a getter for birthdayin class

Com. hibernate. domain. User

Atorg. hibernate. Property. basicpropertyaccessor. creategetter (basicpropertyaccessor. Java: 326)

Atorg. hibernate. Property. basicpropertyaccessor. getgetter (basicpropertyaccessor. Java: 320)

Atorg. hibernate. Mapping. Property. getgetter (property. Java: 304)

Atorg. hibernate. tuple. entity. pojoentitytuplizer. buildpropertygetter (pojoentitytuplizer. Java: 297)

Atorg. hibernate. tuple. entity. abstractentitytuplizer. <init> (abstractentitytuplizer. Java: 155)

Atorg. hibernate. tuple. entity. pojoentitytuplizer. <init> (pojoentitytuplizer. Java: 77)

... 38 more

Cause of exception:

The property privatedate birthday is defined in user. Java;

Define birthday in user. HBM. xml: <propertyname = "Birthday"/>

However, the set and get methods corresponding to birthday are not written in user. java.

 

 

Exception 3:

Exception in thread "Main" Java. Lang. exceptionininitializererror

Atcom. hbsi. Test. manytow.add (manytow.java: 31)

Atcom. hbsi. Test. manytow.main (manytow.java: 21)

Caused by: org. hibernate. mappingexception: An association from the table teacher_student refers to an unmapped class: COM. hbsi. domain. Teacher

Atorg. hibernate. cfg. configuration. secondpasscompileforeignkeys (configuration. Java: 1824)

Atorg. hibernate. cfg. configuration. originalsecondpasscompile (configuration. Java: 1756)

Atorg. hibernate. cfg. configuration. secondpasscompile (configuration. Java: 1423)

Atorg. hibernate. cfg. configuration. buildsessionfactory (configuration. Java: 1856)

Atcom. hbsi. hibernate. utils. hibernateutil. <clinit> (hibernateutil. Java: 19)

... 2 more

This error occursCauseIs in student. HBM. xml

<Setname = "Teachers" table = "teacher_student">

<Keycolumn = "student_id"> </key>

<Role-to-manyclass = "teacher" column = "teacher_id"/>

</Set>

Write the teacher in class = "teacher" as a teacher.

In addition to these three minor exceptions, there may be many exceptions due to carelessness. For example, this morning I thought there were no errors in the configuration file and the ing file, but it was an exception during initialization. It took only half a day to know that it was because

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.