[jboss-as7-dev] Setting JPA ClassTranformer and how can a service be started before any DUPs start scanning deployment classes?
Scott Marlow
smarlow at redhat.com
Mon Jul 2 11:51:58 EDT 2012
I need to start the JPA persistence unit service
(javax.persistence.EntityManagerFactory), before the deployments classes
have been read. Currently, POST_MODULE_INJECTION_ANNOTATION and other
DUPs can read application classes before the persistence unit service is
started.
I tried changing the JPA related DUPs to start as early as possible but
that doesn't help since the JPA persistence unit service doesn't
actually start until the INSTALL phase (well after the
POST_MODULE_INJECTION_ANNOTATION has already read application classes).
If we were to create the javax.persistence.EntityManagerFactory during
an early PHASE (probably in a "first time access" phase after the module
is defined), we would also need the datasource to be available early (to
handle certain cases that require it (e.g. creating database tables or
checking JDBC DatabaseMetaData.)
Is there a way to get early (equivalent to PHASE.POST_MODULE time)
access to a datasource?
https://github.com/scottmarlow/jboss-as/tree/AS7-4996_class_transformer_part2
contains some hacks that I started and the current JPA datasource access
code is at
https://github.com/scottmarlow/jboss-as/blob/AS7-4996_class_transformer_part2/jpa/core/src/main/java/org/jboss/as/jpa/processor/PersistenceUnitServiceHandler.java#L318
AS7-4996 is the jira for this change and contains an IRC transcript from
a conversation last fall about getting JPA class transformers to work.
The changes that we made last fall, worked for the simple test case but
not all applications.
Scott
More information about the jboss-as7-dev
mailing list