OpenJPA
  1. OpenJPA
  2. OPENJPA-915

PCEnhancer cannot enhance an entity bean in a jar

    Details

    • Type: Improvement Improvement
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None
    • Environment:
      linux, java 1.6.0_12

      Description

      The PCEnhancer fails when trying to enhance an entity bean found in a jar. It tries and fails to write the enhanced class output to the jar rather than the build directory of the project.

      This means I cannot have my entity bean superclass in a seperate framework-centric project for re-use by all JPA-based projects, unless I enhance the class when jarring up the framework project. This would prevent me from sharing the jar with other JPA-based projects which don't use OpenJPA.

      I would recommend that the PCEnhancer checks the file path to write the enhanced class to before writing and removes any Jar-prefix if present, writing the class to the normal build directory.

        Activity

        Hide
        Albert Lee added a comment -

        Enhancement process is to insert JPA "magics" into the entity class byte stream. Using container managed or javaagent can perform this transformation on the fly during an entity class loading process. Otherwise, build time enhancement of dependent entity super class requires the build process to expand the depending jar file content, run the enhancer and zip it back up. This is only require for a one-time processing.

        Show
        Albert Lee added a comment - Enhancement process is to insert JPA "magics" into the entity class byte stream. Using container managed or javaagent can perform this transformation on the fly during an entity class loading process. Otherwise, build time enhancement of dependent entity super class requires the build process to expand the depending jar file content, run the enhancer and zip it back up. This is only require for a one-time processing.
        Hide
        yangjun added a comment -

        Is it possible to enhance super class from dependency at build time? if not how to workaround?

        Show
        yangjun added a comment - Is it possible to enhance super class from dependency at build time? if not how to workaround?
        Hide
        yangjun added a comment -

        Thanks for your reply. I tried your advise, Unfortunately it is not working. any other ideas?

        Show
        yangjun added a comment - Thanks for your reply. I tried your advise, Unfortunately it is not working. any other ideas?
        Hide
        Albert Lee added a comment -

        I am not familiar with Karaf. From just browsing the Karaf home site, it looks like it is a osgi based runtime but without JPA container-managed persistence support. Therefore it does not perform runtime enhancement.

        Just a guess, I wonder if you can use -javaagent when launching Karaf so that the enhancer can be tapped into Karaf's runtime.

        Albert.

        Show
        Albert Lee added a comment - I am not familiar with Karaf. From just browsing the Karaf home site, it looks like it is a osgi based runtime but without JPA container-managed persistence support. Therefore it does not perform runtime enhancement. Just a guess, I wonder if you can use -javaagent when launching Karaf so that the enhancer can be tapped into Karaf's runtime. Albert.
        Hide
        yangjun added a comment - - edited

        I am now facing the same issue.
        Right now MyEntity extends super class from dependency jar which could not enhanced at build time.
        Since I am using Karaf as container, there are no ways to introduce runtime Enhancement as far as I could see.
        Any body has opinions?

        Show
        yangjun added a comment - - edited I am now facing the same issue. Right now MyEntity extends super class from dependency jar which could not enhanced at build time. Since I am using Karaf as container, there are no ways to introduce runtime Enhancement as far as I could see. Any body has opinions?
        Adam Hardy created issue -

          People

          • Assignee:
            Unassigned
            Reporter:
            Adam Hardy
          • Votes:
            2 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:

              Development