Hibernate---java.lang.UnsupportedOperationException:The user must supply a JDBC connection

Source: Internet
Author: User

When you configure hibernate, the code is executed with errors:

Exception in thread "main" Java.lang.UnsupportedOperationException:The user must supply a JDBC Connectionat org.hibernate . Connection. Usersuppliedconnectionprovider.getconnection (usersuppliedconnectionprovider.java:54) at Org.hibernate.jdbc.ConnectionManager.openConnection (connectionmanager.java:446) at Org.hibernate.jdbc.ConnectionManager.getConnection (connectionmanager.java:167) at Org.hibernate.jdbc.AbstractBatcher.prepareQueryStatement (abstractbatcher.java:161) at Org.hibernate.loader.Loader.prepareQueryStatement (loader.java:1616) at Org.hibernate.loader.Loader.doQuery ( loader.java:717) at Org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections (loader.java:270) at Org.hibernate.loader.Loader.loadEntity (loader.java:1953) at Org.hibernate.loader.entity.AbstractEntityLoader.load (abstractentityloader.java:86) at Org.hibernate.loader.entity.AbstractEntityLoader.load (abstractentityloader.java:76) at Org.hibernate.persister.entity.AbstractEntityPersister.load (Abstractentitypersister.java:3270) at Org.hibernate.event.def.DefaultLoadEventListener.loadFromDatasource (defaultloadeventlistener.java:496) At Org.hibernate.event.def.DefaultLoadEventListener.doLoad (defaultloadeventlistener.java:477) at Org.hibernate.event.def.DefaultLoadEventListener.load (defaultloadeventlistener.java:227) at Org.hibernate.event.def.DefaultLoadEventListener.proxyOrLoad (defaultloadeventlistener.java:285) at Org.hibernate.event.def.DefaultLoadEventListener.onLoad (defaultloadeventlistener.java:152) at Org.hibernate.impl.SessionImpl.fireLoad (sessionimpl.java:1080) at Org.hibernate.impl.SessionImpl.get ( sessionimpl.java:997) at Org.hibernate.impl.SessionImpl.get (sessionimpl.java:990) at Com.ado.test.hibernate.HibernateTest.main (HIBERNATETEST.JAVA:25)

Later looked at the background of the source code, found to create a ConnectionProvider instance of Usersuppliedconnectionprovider (user-defined provider), configuration is a bit unusual. Breakpoints track the code that created the instance because the configuration property keyword is not the same as the Hibernate keyword when it is created based on individual configuration properties, resulting in the creation of a user-defined provider, resulting in the exception above.

The test code uses Hibernate 3.5.6, a standard keyword that can be used to view definitions in the Org.hibernate.cfg.Environment class. Hibernate version is different, the use of the keyword is not the same. This should be noted.

Hibernate 3.5.6 is used by:

Hibernate.connection.driver_ Classhibernate.connection.urlhibernate.connection.usernamehibernate.connection.password




Hibernate---java.lang.UnsupportedOperationException:The user must supply a JDBC connection

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.