This project provides a simple EJB application for Jakarta EE developers to start a Jakarta EE 10 project with Hazelcast cache mechanism.
It contains a collection of simple examples to demonstrate the Jakarta EE specifications, Hazelcast caching and backend database example configuration for continuous integration and continuous deployment purpose.
Read the online docs:
- Create database table by run [ozssc_event_table.sql] under sql directory in resources.
- Load PostgrSQL jdbc driver as Lib into Payara-6 domain.
- Create datasource to be accessed over jdbc on payara-6.2023.10 domain server:
- create connection pool by run [$ADMIN_COMMAND --passwordfile $PW_FILE create-jdbc-connection-pool --datasourceclassname $XA_DS --restype javax.sql.XADataSource --property url="jdbc:postgresql://$HOST:$PORT/ozssc":user="tomcat":password="******":host="$HOST":port=$PORT:database="ozssc" --steadypoolsize 64 --maxpoolsize 128 $OZSSC_CP]
- create JDBC datasource by run [$ADMIN_COMMAND --passwordfile $PW_FILE create-jdbc-resource --connectionpoolid $OZSSC_CP --enabled true $OZSSC_JDBC_RSC]
- create resource reference by run [$ADMIN_COMMAND --passwordfile $PW_FILE create-resource-ref --target server $OZSSC_JDBC_RSC]
- Verify it from Admin_UI (http://rocky9thss1:4848), found jndi name as: jdbc/PG15_ozssc_150
- Create persistence.xml under resources/META-INF to configure JTA Persistence Unit
- Create entity class ([Event.Java]) to store and to be accessed by frontage, create DataSerializableFactory [EventDataSerializableFactory.java] to allow payara to process serialize and deserialize,create customer MapStore [EventMapStore.java] under module [JTALibJar] to let Hazelcast to load and store entity to backend database.
- Create a simple Singleton Enterprise java bean (Scheduler.java) under module JTASchedulerEJB to hold a scheduler to access Hazelcast map
- Compile and deploy it to Payara Domain
- Deploy JTALibJar as common lib by add-library CLI
- Deploy JTASchedulerEJB as ejb by using deploy in CLI
- Re-configure hazelcast-config.xml by add event map definition and serializable section
- upload hazelcast-config.xml to $PAYARA_DOMAIN/config directory and restart domain
- Check console log and database to verify it
- Operating system: Rocky Linux 9.2
- Oracle JDK 17.0.7
- PostgreSQL 15
- Payara Community 6.2023.10 (jakarta EE 10 and Hazelcast 5.3)