RSA 8, WAS 7, SCA and JPA 2.0 feature packs
I have an SCA component with a Java implementation and a web service binding. My Java implementation uses JPA for persistence. No matter how I try to configure my projects (1 project with everything, 1 SCA project + 1 JPA project...), I can't get JPA to work properly. Specifically, my JPA beans are not being enhanced, which ends up in an exception being thrown.
Does anybody have an example of a working configuration? I'm very open about the packaging and can do whatever it takes. Thanks!
SystemAdmin 110000D4XK126 Posts
Re: SCA and JPA2011-03-02T18:21:40ZThis is the accepted answer. This is the accepted answer.Hi Florian.
What exactly do you mean with "my JPA beans are not being enhanced"? And, what's the exception you got?
"Software development has been, is, and will remain fundamentally hard"
- Grady Booch
Re: SCA and JPA2011-03-02T18:47:53ZThis is the accepted answer. This is the accepted answer.
- SystemAdmin 110000D4XK
3/2/11 12:52:11:337 EST00000024 DataAccessorI E Error parsing entity types for application HiltonDemo
<openjpa-2.0.1-SNAPSHOT-r422266:980199 fatal user error> org.apache.openjpa.util.MetaDataException: The type "class com.ibm.bedl.jpa.Charge" has not been enhanced.
HasanMuhammad 060001CT108 Posts
Re: SCA and JPA2011-03-02T20:05:47ZThis is the accepted answer. This is the accepted answer.SCA FEP supports JEE resources that are explicitly wired. However, we do not support impl.java with JPA since there is no architected java:/comp space for implementation.java programs, and further we have no architected place in the SCA contribution for res-refs. If this was supported you could have tied impl.java with EntityManager by binding the @EntityManager to JNDI resource, and then wiring impl.java to this resource.
Both OSGi and JEE define how to cope with res-refs. Hence you'll need an implementation type that is also a JPA container, e.g impl.osgi or impl.jee. For OSGI application, the OSGI FEP ships a sample called "blog" which shows how to do JPA using POJOs and Blueprint. But in SCA FEP, we dont yet have an official sample that shows how to use an OSGI application as a component implementation type.
sutter 120000EB4G1 Post
Re: SCA and JPA2011-03-02T20:47:38ZThis is the accepted answer. This is the accepted answer.
- HasanMuhammad 060001CT10
I am not an SCA expert, but I do know a few things about JPA... It sounds like SCA by itself does not provide a "container-like" environment that would support the necessary infrastructure for JPA managed persistence. If you combine SCA with either the OSGi or Java EE runtime, then the infrastructure would be in place.
But, you should (key word here) be able to use JPA in a non-managed or application managed environment. In this case, you would have to ensure that your Entity classes are enhanced during your build process . And, your application would have to take care of creating and managing the EntityManagerFactories and EntityManagers. It's more work on your part, but you would still have the advantage of the JPA programming model and the consistencies that it provides.
Although a little dated (an update should be posted this month), this article  on developer works talks about using OpenJPA in a non-managed WAS v6.1 environment. In my mind, this usage would be similar to what is being requested here for the SCA environment. Essentially, you would be using JPA as a utility framework.
I hope I haven't opened a can of worms for the SCA team... :-)
Re: SCA and JPA2011-03-04T14:52:17ZThis is the accepted answer. This is the accepted answer.
- sutter 120000EB4G
Re: SCA and JPA2011-03-04T14:54:25ZThis is the accepted answer. This is the accepted answer.
- HasanMuhammad 060001CT10