I use Glassfish 3.1.2.2 (build 5), JPA, EclipseLink, MySQL
I created MySQL pool via Glassfish admin panel. Ping to MySQL from GF admin panel is ok.
I created
I had the same problem and I firmly believe it is caused by some remainig-cache.
Just after I've done
asadmin remove-domain domain1
asadmin create-domain domain1
firefox http://localhost:4848
Now __pm
is not appended anymore to JDBC resources.
if this does not help, then I assume that you are using
@PersistenceContext
EntityManager em;
this should be replaced with e.g.
em=Persistence.createEntityManagerFactory("DefaultPU(PUT_PERSISTANCE_UNIT_NAME_HERE").createEntityManager();
String ret="Hello " + txt + ", "+ em.createNamedQuery("Usertable.findAll").getResultList().get(0).toString() +" !" ;
em.close();
the __nontx and __pm are extensions to the pool. documentation: https://docs.oracle.com/cd/E19798-01/821-1752/beamr/index.html (somewhere else http://docs.oracle.com/cd/E26576_01/doc.312/e24930/jdbc.htm#GSDVG00185 and http://docs.oracle.com/cd/E26576_01/doc.312/e24930/transaction-service.htm#GSDVG00512)
first __pm
from https://docs.oracle.com/cd/E19798-01/821-1752/gavro/index.html
Allowing Non-Component Callers
You can allow non-Java-EE components, such as servlet filters, lifecycle modules, and third party persistence managers, to use this JDBC connection pool. The returned connection is automatically enlisted with the transaction context obtained from the transaction manager. Standard Java EE components can also use such pools. Connections obtained by non-component callers are not automatically closed at the end of a transaction by the container. They must be explicitly closed by the caller.
You can enable non-component callers in the following ways:
Check the Allow Non Component Callers box on the Edit Connection Pool Advanced Attributes page in the Administration Console. The default is false. For more information, click the Help button in the Administration Console.
Specify the ----allownoncomponentcallers option in the asadmin create-jdbc-connection-pool command. For more information, see the Oracle GlassFish Server 3.0.1 Reference Manual.
Specify the allow-non-component-callers option in the asadmin set command. For example:
asadmin set domain1.resources.jdbc-connection-pool.DerbyPool.allow-non-component-callers=true
For more information, see the Oracle GlassFish Server 3.0.1 Reference Manual.
Create a JDBC resource with a __pm suffix.
and __nontx
from https://docs.oracle.com/cd/E19798-01/821-1752/beamu/index.html
Using Non-Transactional Connections
You can specify a non-transactional database connection in any of these ways:
Check the Non-Transactional Connections box on the New JDBC Connection Pool or Edit Connection Pool page in the Administration Console. The default is unchecked. For more information, click the Help button in the Administration Console.
Specify the ----nontransactionalconnections option in the asadmin create-jdbc-connection-pool command. For more information, see the Oracle GlassFish Server 3.0.1 Reference Manual.
Specify the non-transactional-connections option in the asadmin set command. For example:
asadmin set domain1.resources.jdbc-connection-pool.DerbyPool.non-transactional-connections=true
For more information, see the Oracle GlassFish Server 3.0.1 Reference Manual.
Use the DataSource implementation in the GlassFish Server, which provides a getNonTxConnection method. This method retrieves a JDBC connection that is not in the scope of any transaction. There are two variants.
public java.sql.Connection getNonTxConnection() throws java.sql.SQLException
public java.sql.Connection getNonTxConnection(String user, String password) throws java.sql.SQLException
Create a resource with the JNDI name ending in __nontx. This forces all connections looked up using this resource to be non transactional.