Alexander Bobrov created TOMEE-3767:
---------------------------------------
Summary: tomee plume ignore jndi datasource in persistence.xml
Key: TOMEE-3767
URL: https://issues.apache.org/jira/browse/TOMEE-3767
Project: TomEE
Issue Type: Bug
Affects Versions: 7.0.0
Environment: tomee plume 1.7.5
eclipselink 2.4.2
jpa 2.0
tomee plume 8.0.8
eclipselink 2.7.7
jpa 2.0
Reporter: Alexander Bobrov
Fix For: 1.7.5
Eclipselink ignore JNDI name context in persistence.xml file since tomee 7.0
I create 2 project on github with equal source, but different version of tomee
1.7.5 - lust success work and 8.0.8 - last avaliable in maven repository
8.0.8 just ignore JNDI name context connection and get default hsql db
connection, but 1.7.5 work currectly
1, with good job project - [https://github.com/alexanderbobrov/tomee1.7jpa]
2, fail project - [https://github.com/alexanderbobrov/tomee8jpa]
In this project I try compare connection string that i give from directly from
JNDI and from entity manager
context.xml work local on machines with trusted connection postgresql server
{code:xml}
<Resource name="jdbc/test_ds" auth="Container" type="javax.sql.DataSource"
username="postgres" password="" driverClassName="org.postgresql.Driver"
url="jdbc:postgresql://localhost:5432/postgres?currentSchema=public"
maxTotal="25000" maxIdle="1000" validationQuery="select 1" />
{code}
persistence.xml
{code:xml}
<non-jta-data-source>test_ds</non-jta-data-source>
{code}
and java code
{code:java}
@PersistenceUnit(unitName="persunit")
private EntityManagerFactory factory;
@Resource(name="jdbc/test_ds")
private DataSource dataSource;
.....
PrintWriter out = response.getWriter();
Connection con = dataSource.getConnection();
out.println("connection url from datasource
resource\n"+con.getMetaData().getURL()+"\n");
EntityManager em = factory.createEntityManager();
Connection con = em.unwrap(java.sql.Connection.class);
out.println("connection url from entity
manager\n"+con.getMetaData().getURL()+"\n");
{code}
an tomee plume 1.7.5 i get equally connection string at both way
----
connection url from datasource resource
jdbc:postgresql://localhost:5432/postgres?currentSchema=public
connection url from entity manager
jdbc:postgresql://localhost:5432/postgres?currentSchema=public
----
but in tomee plume 8.0.8 connection string be different
----
connection url from datasource resource
jdbc:postgresql://localhost:5432/postgres?currentSchema=public
connection url from entity manager
jdbc:hsqldb:[file:D:\git\tomee8jpa\target\apache-tomee\data\hsqldb\hsqldb|file:///D:/gittomee8jpatargetapache-tomeedatahsqldbhsqldb]
----
--
This message was sent by Atlassian Jira
(v8.3.4#803005)