Skip to content

Instantly share code, notes, and snippets.

Avatar
🙃

Laird Nelson ljnelson

🙃
View GitHub Profile
View Configuring application.yaml
server:
port: 8080
javax:
sql:
DataSource:
greetingDataSource:
dataSourceClassName: org.h2.jdbcx.JdbcDataSource
dataSource:
url: jdbc:h2:mem:greeting;INIT=RUNSCRIPT FROM 'classpath:greeting.ddl'
user: sa
View Injecting a TransactionManager.java
import javax.inject.Inject;
import javax.transaction.TransactionManager;
@Inject
private TransactionManager transactionManager;
View Injecting a named datasource.java
import javax.inject.Inject;
import javax.inject.Named;
import javax.sql.DataSource;
@Inject
@Named("yourDataSourceName")
private DataSource dataSource;
View Including JPA and JTA APIs.xml
<dependency>
<groupId>jakarta.persistence</groupId>
<artifactId>jakarta.persistence-api</artifactId>
<version>2.2.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.transaction</groupId>
<artifactId>javax.transaction-api</artifactId>
<version>1.2</version>
View Including Helidon Eclipselink integration.xml
View Including Helidon JPA support.xml
<dependency>
<groupId>io.helidon.integrations.cdi</groupId>
<artifactId>helidon-integrations-cdi-jpa</artifactId>
<scope>runtime</scope>
</dependency>
View Including Narayana integration.xml
<dependency>
<groupId>io.helidon.integrations.cdi</groupId>
<artifactId>helidon-integrations-cdi-jta-weld</artifactId>
<scope>runtime</scope>
</dependency>
View Including HikariCP integration.xml
<dependency>
<groupId>io.helidon.integrations.cdi</groupId>
<artifactId>helidon-integrations-cdi-datasource-hikaricp</artifactId>
<scope>runtime</scope>
</dependency>
View Including H2 dependency.xml
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>1.4.200</version>
<scope>runtime</scope>
</dependency>
View Maven JPA archetype invocation
mvn archetype:generate \
-DinteractiveMode=false \
-DarchetypeGroupId=io.helidon.archetypes \
-DarchetypeArtifactId=helidon-mp \
-DarchetypeVersion=2.0.0-M1 \
-DgroupId=io.helidon.example \
-DartifactId=helidon-jpa \
-Dpackage=io.helidon.example.jpa \
-DrestResourceName=ExampleResource \
-DapplicationName=ExampleApplication