[jboss-as7-dev] detecting JPA usage in AS7 applications...

Jaikiran Pai jpai at redhat.com
Fri Jun 10 03:13:19 EDT 2011


On Friday 10 June 2011 01:07 AM, Scott Marlow wrote:
>
> This is wrong I think.  We probably only need to look for the presence
> of @PersistenceUnit @PersistenceContext and same in deployment
> descriptors (which we currently also do).
In earlier versions of JBoss AS, we used to (optionally) bind the 
EntityManager and the EntityManagerFactory to a global JNDI name within 
the server. This was a JBoss specific feature (@see 
jboss.entity.manager.jndi.name and 
jboss.entity.manager.factory.jndi.name in Table 3.1 here 
http://docs.jboss.org/ejb3/docs/reference/1.0.7/html/entityconfig.html). 
Do we still do this in AS7 or do we plan to do this? Probably allow them 
to bind to java:jboss/ namespace?

The reason I ask this is because if we introduce this feature, then just 
relying on @PersistenceUnit and @PersistenceContext annotations won't be 
enough, since users might lookup the EntityManagerFactory/EntityManager 
via JNDI and in such cases too we will require the JPA module 
dependencies to be added implicitly.

>
> I don't want to inject the JPA dependencies just because there is
> persistence unit definition (we can still parse it and have it available
> for use).
>
> This might help us deploy native Hibernate applications that don't use
> EE JPA.
I haven't looked at the code related to this (yet), but I'm curious 
about how this works and whether this implicit Hibernate dependencies is 
going to cause any issues. So:

1) When we say, we are adding implicit JPA dependencies to the 
deployment, what exact modules are we adding? JPA spec API module 
(javax.persistence.* classes) is fine. Are we adding Hibernate module as 
a dependency too?

2) If we are adding a implicit Hibernate dependency, then, is there an 
(easy) way for users to specify that this implicit Hibernate dependency 
*not* be added? That way, users can package their own version of 
Hibernate within their deployments. Note that this is probably going to 
be pretty common question from users, because in AS7 we are shipping 
Hibernate 4.x version which isn't yet used by many applications. 
Hibernate 3.x is the stable version, so I believe users would want to 
package that version in their app and use it.

3) If we are adding a implicit Hibernate dependency, then, is there an 
(easy) way for users to use a different JPA provider (like EclipseLink)?

-Jaikiran


More information about the jboss-as7-dev mailing list