1

I have an Entity with a field of byte array type.

The static meta model is throwing an error during deploy.

I would try to fix it if I wanted to query on that field but I do not. It is binary data @Lob.

Is there an @Annotation to make the auto-gen skip a field during compile? Even a class altogether, I can get away with using JPQL for that class only while awaiting a fix.

I am working in Rational App. Developer (Eclipse/OpenJPA)

Thanks,

Thierry Dupard

TDupard
  • 43
  • 7
  • In the mean time this persistence.xml property can alleviate the issue by changing the behavior of compile tool: and also when regenerating the model, add this to the javac command: -Aopenjpa.Compatibility=UseListAttributeForArrays=false – TDupard Nov 29 '13 at 14:08
  • The actual error thrown (at runtime only by the way, this thing compiles fine...): java.lang.IllegalArgumentException: Can not set static javax.persistence.metamodel.SingularAttribute field com.mycompany.ejb.entity.Myclass_.fileContent to org.apache.openjpa.persistence.meta.Members$ListAttributeImpl – TDupard Nov 29 '13 at 16:01
  • Found the answer, pretty simple actually. Since MetaModel generation is tied to the compiler all one needs to do is enable project specific exclusion patterns in the BuildPath source tab of either Eclipse or RAD. I still wanted my class to compile but not its *_.java version so applying the pattern to the MetaModel source folder does the trick i.e. : "/.apt_generated" – TDupard Dec 18 '13 at 13:58

1 Answers1

1

You can delete the files after compilation:

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.7</version>
<executions>
    <execution>
        <phase>compile</phase>
        <goals>
            <goal>run</goal>
        </goals>
        <configuration>
            <tasks>
                <delete>
                    <fileset dir="${project.build.outputDirectory}/../generated-sources/annotations/org/...="*.java" />
                    <fileset dir="${project.build.outputDirectory}/org/..." includes="*_.class" />
                </delete>
            </tasks>
        </configuration>
    </execution>
</executions>
</plugin>
m43x
  • 225
  • 1
  • 3
  • 11