I'm using apache-tomee-webprofile-9.0.0-M7 to try to get into JSF. To that end, I decided to adapt the Weld JSF "login" example. The first thing that I decided to do is to connect persistence to MySql. Here is the datasource being seen by the container:
02-Jul-2022 18:42:08.123 INFO [main] org.apache.openejb.config.AutoConfig.processResourceRef Auto-linking resource-ref 'openejb/Resource/jdbc/MySqlDS' in bean weld-login.Comp387377349 to Resource(id=weld-login/jdbc/MySqlDS)
But here is what gets used - attempting to use HSQL (at least I assume that's what this means):
02-Jul-2022 18:42:55.464 INFO [http-nio-8080-exec-5] null.openjpa.Runtime Starting OpenJPA 3.1.2
02-Jul-2022 18:42:55.568 INFO [http-nio-8080-exec-5] null.openjpa.jdbc.JDBC Using dictionary class "org.apache.openjpa.jdbc.sql.HSQLDictionary" (HSQL Database Engine 2.3.2 ,HSQL Database Engine Driver 2.3.2).
02-Jul-2022 18:42:55.590 INFO [http-nio-8080-exec-5] null.openjpa.jdbc.JDBC Connected to HSQL Database Engine version 2.3 using JDBC driver HSQL Database Engine Driver version 2.3.2.
This is the configuration as far as I've done it. What am I missing? ($CATALINA_HOME/conf/context.xml)
<?xml version="1.0" encoding="UTF-8"?>
<Context>
<!-- Default set of monitored resources. If one of these changes, the -->
<!-- web application will be reloaded. -->
<WatchedResource>WEB-INF/web.xml</WatchedResource>
<WatchedResource>WEB-INF/tomcat-web.xml</WatchedResource>
<WatchedResource>${catalina.base}/conf/web.xml</WatchedResource>
<Resource name="jdbc/MySqlDS" auth="Container" type="javax.sql.DataSource"
maxTotal="100" maxIdle="30" maxWaitMillis="10000"
username="goose" password="xxx" driverClassName="com.mysql.cj.jdbc.Driver"
url="jdbc:mysql://nucsrv.home:3306/weldcdi"/>
</Context>
(/META-INF/.persistence.xml)
<?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns="http://xmlns.jcp.org/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd"
version="2.1">
<persistence-unit name="loginDatabase">
<!--
<jta-data-source>java:jboss/datasources/ExampleDS</jta-data-source>
-->
<jta-data-source>jdbc/MySqlDS</jta-data-source>
<properties>
<!--
<property name="hibernate.hbm2ddl.auto" value="create-drop"/>
<property name="hibernate.show_sql" value="false"/>
-->
<property name="javax.persistence.jdbc.driver" value="com.mysql.cj.jdbc.Driver"/>
<property name="javax.persistence.jdbc.url" value="jdbc:mysql://nucsrv.home/weldcdi"/>
<property name="hibernate.dialect" value="org.hibernate.dialect.MySQL8Dialect" />
<property name="javax.persistence.jdbc.user" value="goose"/>
<property name="javax.persistence.jdbc.password" value="xxx"/>
<property name="hibernate.show_sql" value = "true" />
<property name="hibernate.format_sql" value = "true" />
<property name="javax.persistence.schema-generation.database.action" value="create"/>
</properties>
</persistence-unit>
</persistence>