0

Well, i'm trying to follow the Oracle JSR and use only specifications in my project. I'm using JBOSS EAP 7 as Server APP.

1) I have hibernate dependency in my project:

 <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-core</artifactId>
            <version>${hibernate.core.version}</version>
        </dependency>

This is the correct way to follow specification (JSR) ? Or i should just set the JPA dependency without any hibernate dependency and let jboss take care about it ?

2) Another example: I'm using CDI, and in my project i have the WELD as implementation of CDI:

 <dependency>
            <groupId>org.jboss.weld</groupId>
            <artifactId>weld-core-jsf</artifactId>
            <version>2.3.3.Final</version>
        </dependency>

Should i replace it for a CDI-API dependency and let jboss takes care about implentation ?

What is the correct way to follow the JSR and go away from implementations ?

Ronaldo Lanhellas
  • 2,975
  • 5
  • 46
  • 92
  • According to me for persistence, you should use JPA. That way you just need to define the `jpa` dependency in your project and need not to define the `hibernate` dependency if you are deploying the app in `jboss as7`. This is how `jboss as7` detects the `jpa` - `JPA use is detected (e.g. persistence.xml or @PersistenceContext/Unit annotations) and injects Hibernate dependencies into the application deployment.` You can refer more [here](https://docs.jboss.org/author/display/AS7/JPA+Reference+Guide) – Rishikesh Darandale Oct 06 '17 at 15:26
  • I want make a pom deployed to a Lot of server app (JBoss,glassfish...) – Ronaldo Lanhellas Oct 06 '17 at 15:30
  • In that case you will have to add `jpa provider` implementation and you have to exclude the jpa detection(while deployment) in case `jboss as7`. – Rishikesh Darandale Oct 06 '17 at 15:35

1 Answers1

0

I haven't used JBoss EAP 7; but from its feature list it should implement Java EE 7 full profile. If that is the case, all that you need is the following Maven dependency:

<dependency>
    <groupId>javax</groupId>
    <artifactId>javaee-api</artifactId>
    <version>7.0</version>
    <scope>provided</scope>
</dependency>

This should work as long as you deploy your application on one of full featured application servers (Wildfly/JBoss, Glassfish, Websphere,...) which support Java EE 7.

ujulu
  • 3,289
  • 2
  • 11
  • 14