Skip to content

Commit

Permalink
update for tomee
Browse files Browse the repository at this point in the history
  • Loading branch information
rieckpil committed Mar 23, 2019
1 parent 3fdd43e commit 8e1b265
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
Expand Up @@ -4,27 +4,23 @@
import java.sql.SQLException;

import javax.annotation.Resource;
import javax.inject.Inject;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.sql.DataSource;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.core.Response;

import org.eclipse.microprofile.config.inject.ConfigProperty;

@Path("sample")
public class SampleResource {

@Inject
@ConfigProperty(name = "message")
private String message;
private String message = "Hello World!";

@PersistenceContext
private EntityManager em;

@Resource(lookup = "jdbc/postgres")
// @Resource(name = "jdbc/postgres") for Tomee
// @Resource(lookup = "java:jboss/datasources/postgres") for WildFly
private DataSource dataSource;

Expand Down
Expand Up @@ -5,6 +5,7 @@
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_2.xsd">
<persistence-unit name="prod" transaction-type="JTA">
<jta-data-source>postgres</jta-data-source>
<!-- for TomEE <jta-data-source>jdbc/postgres</jta-data-source> -->
<!-- for WildFly <jta-data-source>java:jboss/datasources/postgres</jta-data-source> -->
</persistence-unit>
</persistence>

0 comments on commit 8e1b265

Please sign in to comment.