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

Hibernate JIRA | Monique Louise de Barros Monteiro | 5 years ago
tip
Your exception is missing from the Samebug knowledge base.
Here are the best solutions we found on the Internet.
Click on the to mark the helpful solution and get rewards for you help.
  1. 0

    I'm trying to migrate my applications from pure Hibernate to JPA. In my environment, I have a shared library which creates a SessionFactory at startup. Several Web applications use this library and its shared SessionFactory. Also, each Web application uses a particular datasource with a different user/password, although all the applications access the same database. Upon a request, a Session is obtained from a JDBC connection, which is obtained from the application server's managed pool, referenced by the Web application specific JNDI bound datasource. When I try to migrate this cenary to JPA, in the same way, I need to create an EntityManagerFactory at startup and let each Web application request create a new EntityManager from the same factory but with different database connection information. But I had the following problems: - When the EntityManagerFactory is created with a default connection information and the EntityManager is created through EntityManagerFactory.createEntityManager(map), where map contains a JNDI datasource bound to the "javax.persistence.nonJtaDataSource" property, the same EntityManagerFactory connection information is used, and the datasource connection information is completely ignored. - When the EntityManagerFactory is created without any initial connection information, the following error occurs when an EntityManager is created with datasource information and the underlying JDBC connection needs to accessed: java.lang.UnsupportedOperationException: The user must supply a JDBC connection at org.hibernate.connection.UserSuppliedConnectionProvider.getConnection(UserSuppliedConnectionProvider.java:30) at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:423) at org.hibernate.jdbc.ConnectionManager.getConnection(ConnectionManager.java:144) at org.hibernate.jdbc.BorrowedConnectionProxy.invoke(BorrowedConnectionProxy.java:50) at $Proxy116.prepareStatement(Unknown Source) I studyied Hibernate's source code and I'm afraid Hibernate does not allow changing connection information (user, password, datasource, etc.) after EntityManagerFactory creation.

    Hibernate JIRA | 5 years ago | Monique Louise de Barros Monteiro
    java.lang.UnsupportedOperationException: The user must supply a JDBC connection
  2. 0

    I'm trying to migrate my applications from pure Hibernate to JPA. In my environment, I have a shared library which creates a SessionFactory at startup. Several Web applications use this library and its shared SessionFactory. Also, each Web application uses a particular datasource with a different user/password, although all the applications access the same database. Upon a request, a Session is obtained from a JDBC connection, which is obtained from the application server's managed pool, referenced by the Web application specific JNDI bound datasource. When I try to migrate this cenary to JPA, in the same way, I need to create an EntityManagerFactory at startup and let each Web application request create a new EntityManager from the same factory but with different database connection information. But I had the following problems: - When the EntityManagerFactory is created with a default connection information and the EntityManager is created through EntityManagerFactory.createEntityManager(map), where map contains a JNDI datasource bound to the "javax.persistence.nonJtaDataSource" property, the same EntityManagerFactory connection information is used, and the datasource connection information is completely ignored. - When the EntityManagerFactory is created without any initial connection information, the following error occurs when an EntityManager is created with datasource information and the underlying JDBC connection needs to accessed: java.lang.UnsupportedOperationException: The user must supply a JDBC connection at org.hibernate.connection.UserSuppliedConnectionProvider.getConnection(UserSuppliedConnectionProvider.java:30) at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:423) at org.hibernate.jdbc.ConnectionManager.getConnection(ConnectionManager.java:144) at org.hibernate.jdbc.BorrowedConnectionProxy.invoke(BorrowedConnectionProxy.java:50) at $Proxy116.prepareStatement(Unknown Source) I studyied Hibernate's source code and I'm afraid Hibernate does not allow changing connection information (user, password, datasource, etc.) after EntityManagerFactory creation.

    Hibernate JIRA | 5 years ago | Monique Louise de Barros Monteiro
    java.lang.UnsupportedOperationException: The user must supply a JDBC connection
  3. 0

    Cannot initialize EntityManager in Netbeans via Junit

    Stack Overflow | 6 years ago | lefty
    java.lang.UnsupportedOperationException: The user must supply a JDBC connection
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Must supply JDBC connection - Spring Forum

    spring.io | 10 months ago
    java.lang.UnsupportedOperationException: The user must supply a JDBC connection
  6. 0

    ext Environment in jboss+tomcat 4.1.2 --user must supply a JDBC connection - Forums | Liferay

    liferay.com | 2 years ago
    java.lang.UnsupportedOperationException: The user must supply a JDBC connection

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. java.lang.UnsupportedOperationException

      The user must supply a JDBC connection

      at org.hibernate.connection.UserSuppliedConnectionProvider.getConnection()
    2. Hibernate
      UserSuppliedConnectionProvider.getConnection
      1. org.hibernate.connection.UserSuppliedConnectionProvider.getConnection(UserSuppliedConnectionProvider.java:30)
      1 frame
    3. Hibernate
      BorrowedConnectionProxy.invoke
      1. org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:423)
      2. org.hibernate.jdbc.ConnectionManager.getConnection(ConnectionManager.java:144)
      3. org.hibernate.jdbc.BorrowedConnectionProxy.invoke(BorrowedConnectionProxy.java:50)
      3 frames
    4. Unknown
      $Proxy116.prepareStatement
      1. $Proxy116.prepareStatement(Unknown Source)
      1 frame