Topic
  • 3 replies
  • Latest Post - ‏2013-01-15T14:37:27Z by sutter
SystemAdmin
SystemAdmin
45 Posts

Pinned topic Re: IBM WAS 7.0.0.13 + JPA 2.0 FP

‏2013-01-11T23:26:21Z |
Hi Kevin,
I'm running my app on WAS 7.0.0.19 with Feature Pack for OSGi Applications and Java Persistence API 2.0:
I have enhanced (build-time) my JPA 2.0 persistence classes and settings on my persistence.xml
• <provider>com.ibm.websphere.persistence.PersistenceProviderImpl</provider>
• <property name="openjpa.RuntimeUnenhancedClasses" value="supported" />

Please advice if I do something wrong here.

Initially I encountered "OutOfMemoryError" but now it seems ok after changes made with the above settings:

"12/20/12 19:42:51:726 PST 00000982 SystemOut O 1425 medx-persistence-pu INFO ThreadPool worker thread #13 openjpa.Enhance - Creating subclass for "[class com.compressus.medx.persistence.entity.Otherpatientaddress, class com.compressus.medx.persistence.entity.Peermsg,........."
"12/20/12 14:55:53:439 PST 00000333 SystemOut O INFO *** Persistence started at Thu Dec 20 14:55:53 PST 2012" seen this Four times before the OutOfMemoryError occurs.
The initial settings were:
  • <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
  • <property name="openjpa.RuntimeUnenhancedClasses" value="unsupported" />

Thanks
Bernard
Updated on 2013-01-15T14:37:27Z at 2013-01-15T14:37:27Z by sutter
  • sutter
    sutter
    94 Posts

    Re: IBM WAS 7.0.0.13 + JPA 2.0 FP

    ‏2013-01-14T15:25:47Z  
    Hi Bernard,
    This sounds like a new question and probably should have had it's own thread... But, I'll respond here first. If you need additional follow-up, it might be good to start a new thread just so that it's easier to track. Thanks.

    You never want to use this property (never):
    <property name="openjpa.RuntimeUnenhancedClasses" value="supported" />

    This "feature" was put in place by the OpenJPA community to help newbies get started with OpenJPA. Unfortunately, the community never put in enough effort to make this work in real production environments, so it was shelved. Since the property and feature are still in the product, some users still stumble across this property and think it's "the answer". It's not. You do not want to use this property or the subclassing support that it enabled.

    The default value for this property in OpenJPA 2.0.x and beyond is "unsupported".

    Instead, you want to use byte-code enhancement of your Entity classes. If you are running in a container-managed environment like WebSphere, then the easiest way to accomplish this if through the classloader transformer hook that exists between the Container and JPA implementations. Otherwise, you will have to decide whether build-time enhancement or the use of the JSE javaagent option is your best option. Here's a link to the OpenJPA web site that explains the various options with links to additional information.

    http://openjpa.apache.org/entity-enhancement.html

    Hope this helps,
    Kevin Sutter, JPA Architect, IBM WebSphere
  • SystemAdmin
    SystemAdmin
    45 Posts

    Re: IBM WAS 7.0.0.13 + JPA 2.0 FP

    ‏2013-01-15T00:01:32Z  
    • sutter
    • ‏2013-01-14T15:25:47Z
    Hi Bernard,
    This sounds like a new question and probably should have had it's own thread... But, I'll respond here first. If you need additional follow-up, it might be good to start a new thread just so that it's easier to track. Thanks.

    You never want to use this property (never):
    <property name="openjpa.RuntimeUnenhancedClasses" value="supported" />

    This "feature" was put in place by the OpenJPA community to help newbies get started with OpenJPA. Unfortunately, the community never put in enough effort to make this work in real production environments, so it was shelved. Since the property and feature are still in the product, some users still stumble across this property and think it's "the answer". It's not. You do not want to use this property or the subclassing support that it enabled.

    The default value for this property in OpenJPA 2.0.x and beyond is "unsupported".

    Instead, you want to use byte-code enhancement of your Entity classes. If you are running in a container-managed environment like WebSphere, then the easiest way to accomplish this if through the classloader transformer hook that exists between the Container and JPA implementations. Otherwise, you will have to decide whether build-time enhancement or the use of the JSE javaagent option is your best option. Here's a link to the OpenJPA web site that explains the various options with links to additional information.

    http://openjpa.apache.org/entity-enhancement.html

    Hope this helps,
    Kevin Sutter, JPA Architect, IBM WebSphere
    Thanks Kevin. How do I setup this within WAS 7.0.0.13 env: "If you are running in a container-managed environment like WebSphere, then the easiest way to accomplish this if through the classloader transformer hook that exists between the Container and JPA implementations." ?

    Bernard
  • sutter
    sutter
    94 Posts

    Re: IBM WAS 7.0.0.13 + JPA 2.0 FP

    ‏2013-01-15T14:37:27Z  
    Thanks Kevin. How do I setup this within WAS 7.0.0.13 env: "If you are running in a container-managed environment like WebSphere, then the easiest way to accomplish this if through the classloader transformer hook that exists between the Container and JPA implementations." ?

    Bernard
    Per Albert's reply to your other post, you will need to ensure that the profile you are working with has been augmented to run with the OSGi / JPA 2.0 Feature Pack. If that has been done, then there's nothing left to "set up". You just need to be using container-managed persistence and the enhancement hook is automatically provided for you.

    As an example, if you inject a PersistenceContext into your EJB, then you are allowing the container to manage the persistence artifacts:

    @PersistenceContext(unitName="myPC")
    EntityManager em;
    :

    Hope this helps,
    Kevin Sutter, JPA Architect, IBM WebSphere