[jboss-as7-dev] Setting JPA ClassTranformer and how can a service be started before any DUPs start scanning deployment classes?

Stuart Douglas stuart.w.douglas at gmail.com
Mon Jul 2 17:26:22 EDT 2012


I think you will need to create a phase especially for this, that just runs the data source install processors, and the JPA install processors. This will however negatively affect deployment performance, as deployment will then be blocked on JPA starting. This is the only way I can see to do this properly.

You would need to register a NEXT_PHASE_DEPS entry on the JPA service, although this would only be needed if the JPA impl actually registered a class transformer.

Stuart

On 03/07/2012, at 1:51 AM, Scott Marlow wrote:

> 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
> _______________________________________________
> jboss-as7-dev mailing list
> jboss-as7-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/jboss-as7-dev




More information about the jboss-as7-dev mailing list