openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kevin Sutter <kwsut...@gmail.com>
Subject Re: Entity not enhanced problem
Date Thu, 16 Dec 2010 14:46:10 GMT
Hi LongkerDandy,
Without diving into your enhancement processing, my guess is that you are
not finding or resolving to the correct persistence unit.  You have two
problems that kind of point at that:

o  You claim that you are doing the build time enhancement, but the classes
being loaded are not enhanced.

o  You have the SynchronizeMappings property specified, but OpenJPA is not
creating the tables for your entities.  (BTW, OpenJPA does not create the
database.  It will only create or modify the tables necessary to store the
entities.)

So, I would take a look at your persistence packaging and ensure that the
proper persistence.xml file is being discovered for your persistence unit.
Turning on tracing may help, but that will depend on your EMF creation
mechanism.  Are you using application-managed or container-managed
persistence?  Which app server (if any)?  Is Spring in the picture?  Lots of
variables come into play when attempting to resolve a persistence unit
lookup.

Good luck,
Kevin

On Thu, Dec 16, 2010 at 8:06 AM, LongkerDandy <longkerdandy@gmail.com>wrote:

> Hi
>
> OpenJPA keep telling me:
> This configuration disallows runtime optimization, but the following listed
> types were not enhanced at build time or at class load time with a
> javaagent:
>
> But I'm already doing the enhancement during maven build.
> I'm tried both maven-openjpa-plugin and maven-antrun-plugin like this:
>
>           <plugin>
>                <groupId>org.apache.maven.plugins</groupId>
>                <artifactId>maven-antrun-plugin</artifactId>
>                <version>1.6</version>
>                <executions>
>                    <execution>
>                        <phase>process-classes</phase>
>                        <configuration>
>                            <tasks>
>                                <taskdef name="openjpac"
> classname="org.apache.openjpa.ant.PCEnhancerTask"
>
> classpathref="maven.compile.classpath"/>
>                                <openjpac>
>                                    <classpath
> refid="maven.compile.classpath"/>
>                                </openjpac>
>                            </tasks>
>                        </configuration>
>                        <goals>
>                            <goal>run</goal>
>                        </goals>
>                    </execution>
>                </executions>
>            </plugin>
>
> And the persistence xml:
>
> <persistence xmlns="http://java.sun.com/xml/ns/persistence"
>             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>             xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
> http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
>             version="2.0">
>
>    <persistence-unit name="medialibraryUnit" transaction-type="JTA">
>        <description>Persistence unit for Chii2 Media Library</description>
>
>
>  <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
>        <jta-data-source>osgi:service/javax.sql.DataSource/(
> osgi.jndi.service.name=jdbc/medialibrarydb)
>        </jta-data-source>
>        <non-jta-data-source>osgi:service/javax.sql.DataSource/(
> osgi.jndi.service.name=jdbc/medialibrarydbnojta)
>        </non-jta-data-source>
>
>        <!-- Mapping Classes -->
>        <class>org.chii2.medialibrary.persistence.entity.MovieImpl</class>
>
>  <class>org.chii2.medialibrary.persistence.entity.MovieFileImpl</class>
>
>  <class>org.chii2.medialibrary.persistence.entity.MovieInfoImpl</class>
>
>  <class>org.chii2.medialibrary.persistence.entity.MovieImageImpl</class>
>        <exclude-unlisted-classes>true</exclude-unlisted-classes>
>
>        <properties>
>            <property name="openjpa.Log" value="DefaultLevel=WARN,
> Runtime=INFO, Tool=INFO"/>
>            <property name="openjpa.jdbc.SynchronizeMappings"
> value="buildSchema(ForeignKeys=true)"/>
>            <property name="openjpa.jdbc.DBDictionary" value="derby"/>
>        </properties>
>
>    </persistence-unit>
> </persistence>
>
>
> When I build with maven, I didn't see any error.
> The database created by OpenJPA doesn't contain any table related to my
> entity!
> I don't know where else to looking at.
> Is that possible this error caused by something else, not related to the
> enhancement?
>
> And clue would be very thankful.
>
> Regards
> LongkerDandy
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message