https://github.com/microbean/microbean-jpa-cdi
A CDI portable extension bringing JPA to CDI 2.0-based Java SE programs.
https://github.com/microbean/microbean-jpa-cdi
cdi cdi-extension cdi2 cdi20 java jpa portable-extension
Last synced: 7 months ago
JSON representation
A CDI portable extension bringing JPA to CDI 2.0-based Java SE programs.
- Host: GitHub
- URL: https://github.com/microbean/microbean-jpa-cdi
- Owner: microbean
- License: apache-2.0
- Created: 2018-12-12T20:20:34.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2019-03-06T23:44:38.000Z (about 7 years ago)
- Last Synced: 2025-07-04T00:02:16.952Z (10 months ago)
- Topics: cdi, cdi-extension, cdi2, cdi20, java, jpa, portable-extension
- Language: Java
- Homepage: https://microbean.github.io/microbean-jpa-cdi
- Size: 1.52 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# microBean JPA CDI Extension
[](https://travis-ci.org/microbean/microbean-jpa-cdi)
[](https://maven-badges.herokuapp.com/maven-central/org.microbean/microbean-jpa-cdi)
The microBean JPA CDI Extension brings JPA to CDI.
If you are programming in an environment that already has JPA, such as
a Java EE application server, then this extension is not for you.
If you are writing a Java SE program using CDI, then this extension
may very well be for you.
In terms of end-user-observable effects, this extension allows you to
do the following:
```
public class MyCDIBean {
@PersistenceContext(unitName = "dev")
private EntityManager em;
}
```
That is, you can inject an `EntityManager` as though your CDI-based
standalone Java SE program were in fact a Java EE application server
(at least with respect to JPA).
This extension jumps through a few hoops to ensure that everything is
done as properly as possible.
Specifically, any `DataSource`s behind the scenes are sourced from CDI
itself as just regular CDI beans. Additionally, if your CDI
implementation has transactional support, this extension will leverage
it. Yes, that means your `persistence.xml` can specify transactional
data sources.
This extension is often used in conjunction with the [microBean JPA
Weld SE
Extension](https://github.com/microbean/microbean-jpa-weld-se/), the
[microBean Narayana JTA CDI
Extension](https://github.com/microbean/microbean-narayana-jta-cdi)
project and its [Weld
variant](https://github.com/microbean/microbean-narayana-jta-weld-se),
and the [microBean DataSource CDI HikariCP
Extension](https://microbean.github.io/microbean-datasource-cdi-hikaricp/).