Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6147515
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T19:07:03+00:00 2026-05-23T19:07:03+00:00

I have EJB3 Entity bean which is to be saved in Postgres DB. I

  • 0

I have EJB3 Entity bean which is to be saved in Postgres DB. I am using Glassfish 3 App server for deployment of the EJB.

When I make the call to EJB using my web layer, the DB call is made but Glassfish throws out the following exception

  javax.enterprise.system.std.com.sun.enterprise.server.logging|_ThreadID=135;_ThreadName=Thread-1;|javax.persistence.PersistenceException: org.hibernate.exception.JDBCConnectionException: could not inspect JDBC autocommit mode
at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1215)
at org.hibernate.ejb.AbstractEntityManagerImpl.find(AbstractEntityManagerImpl.java:635)
at org.hibernate.ejb.AbstractEntityManagerImpl.find(AbstractEntityManagerImpl.java:589)
at com.cricinfo.session.service.PlayerService.getPlayer(PlayerService.java:41)

whose root cause is

Caused by: org.hibernate.exception.JDBCConnectionException: could not inspect JDBC autocommit mode
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:99)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:52)
at org.hibernate.jdbc.JDBCContext.afterNontransactionalQuery(JDBCContext.java:296)
at org.hibernate.impl.SessionImpl.afterOperation(SessionImpl.java:595)
at org.hibernate.impl.SessionImpl.get(SessionImpl.java:1010)
at org.hibernate.impl.SessionImpl.get(SessionImpl.java:998)
at  org.hibernate.ejb.AbstractEntityManagerImpl.find(AbstractEntityManagerImpl.java:614)
... 96 more
Caused by: java.sql.SQLNonTransientConnectionException: No current connection.
at org.apache.derby.client.am.SQLExceptionFactory40.getSQLException(Unknown Source)
at org.apache.derby.client.am.SqlException.getSQLException(Unknown Source)
at org.apache.derby.client.am.Connection.getAutoCommit(Unknown Source)
at com.sun.gjc.spi.base.ConnectionHolder.getAutoCommit(ConnectionHolder.java:307)
at org.hibernate.jdbc.ConnectionManager.isAutoCommit(ConnectionManager.java:212)
at org.hibernate.jdbc.JDBCContext.afterNontransactionalQuery(JDBCContext.java:287)
... 100 more
Caused by: org.apache.derby.client.am.SqlException: No current connection.

The connection to the Postgres DB is up and I can view the data using the pgAdmin tool. I can see the query being executed in the logs. From the logs we can see that Glassfish is using a derby client to fetch the connection.

Is there any configuration which I need to make in Glassfish ?

The persistence.xml is :

<persistence-unit name="PlayerApp" transaction-type="RESOURCE_LOCAL">
    <provider>org.hibernate.ejb.HibernatePersistence</provider>
    <class>com.cricinfo.domain.Player</class>
    <properties>
         <property name="hibernate.connection.driver_class" value="org.postgresql.Driver" 
            /> <property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQLDialect" 
            /> <property name="hibernate.hbm2ddl.auto" value="update" /> <property name="hibernate.connection.url" 
            value="jdbc:postgresql://localhost:5432/PlayerAppDB" /> <property name="hibernate.show_sql" 
            value="true" /> <property name="hibernate.format_sql" value="true" /> <property 
            name="hibernate.connection.username" value="postgres" /> <property name="hibernate.connection.password" 
            value="postgres" /> 
    </properties>
</persistence-unit>

I am able to persist and get data by using a standalone class which directly uses the EntityManagerFactory.

EDIT : SOLUTION

I read about it a bit more and realised that I was doing a mistake in the persitence.xml . Now the persistence.xml looks like this :

<persistence-unit name="PlayerApp" transaction-type="JTA">
    <provider>org.hibernate.ejb.HibernatePersistence</provider>
     <jta-data-source>jdbc/DefaultDS</jta-data-source>
    <class>com.cricinfo.domain.Player</class>
</persistence-unit>

The transaction type was made to JTA and a Datasource was used instead of the connection properties.

I also logged into the Glassfish Admin console and configured JDBC Connection Pool and JDBC Resources from the tree CommonTasks-> Resources->JDBC

I am able to get the details now.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T19:07:04+00:00Added an answer on May 23, 2026 at 7:07 pm

    I read about it a bit more and realised that I was doing a mistake in the persitence.xml . Now the persistence.xml looks like this :

    <persistence-unit name="PlayerApp" transaction-type="JTA">
        <provider>org.hibernate.ejb.HibernatePersistence</provider>
         <jta-data-source>jdbc/DefaultDS</jta-data-source>
        <class>com.cricinfo.domain.Player</class>
    </persistence-unit>
    

    The transaction type was made to JTA and a Datasource was used instead of the connection properties.

    I also logged into the Glassfish Admin console and configured JDBC Connection Pool and JDBC Resources from the tree CommonTasks-> Resources->JDBC

    I am able to get the details now.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a JavaEE6-application running on Glassfish v3.0.1 with EJB 3.1 (app is packaged
I have a legacy database, which I am using EJB3 to model. The database
I have Enterprise Application with EJB3 and JSF on Glassfish server. After running this
We have some staleless EJBs (EJB3) deployed on a GlassFish 2 server that expose
I have an app., coded with ejb3, jsf and maven, which runs on jboss
I'm studying EJB3. I have a session bean which provides services to create/update customer
I have an EJB3 application which consists of some EJB's for accessing a DB,
Have just started using Visual Studio Professional's built-in unit testing features, which as I
I am new to JPA/Hibernate. Currently using EJB3, Hibernate/JPA. I have an inheritacnce structure
I am developing a Seam-Jsfv1.2-EJB3 web app. I have a datatable and checkboxes in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.