Avner1508
Avner1508

Reputation: 23

WELD (CDI) + JPA

I try to run the example I found in here: Using CDI/Weld to Inject JPA/Hibernate Entity Managers

and I get the error:

WELD-001408:Unsatisfied dependencies for type EntityDao<User> with qualifiers @Named at injection point [BackedAnnotatedField] @Inject @Named private com.payby.user.UserIdentityDao.baseEntityDao

and also I tried to run the example from: https://bpm.zciok.blog/2017/08/17/hibernate-cdi-example/

but I got the same error. can anyone help me understand why and how I can resolve it.

thanks, Avner

Upvotes: 1

Views: 488

Answers (1)

Mehran Mastcheshmi
Mehran Mastcheshmi

Reputation: 815

For https://bpm.zciok.blog/2017/08/17/hibernate-cdi-example/ do the following changes in pom.xml, please

add persistence-api dependency

   <dependency>
            <groupId>javax.persistence</groupId>
            <artifactId>javax.persistence-api</artifactId>
            <version>2.2</version>
        </dependency>

remove scope:provided from dependencies to hibernate

<dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-core</artifactId>
        <version>${version.hibernate}</version>
        <!--<scope>provided</scope>-->
    </dependency>
    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-validator</artifactId>
        <version>5.1.1.Final</version>
        <!--<scope>provided</scope>-->
    </dependency>
    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-entitymanager</artifactId>
        <version>${version.hibernate}</version>
        <!--<scope>provided</scope>-->
    </dependency>

Upvotes: 1

Related Questions