2009/6/16 David Beer <[email protected]>:
> Hi
>
> I run OpenJPA with NetBeans IDE and have a setup now working. Can you
> paste the contents of your ant script which is associated with the
> enhancer task and your persistence.xml file please.
>
> Do you have any class which extend other entity classes and do not
> provide the @Inheritence annotation.
>
> David

Hi David

Thanks for the quick response. I've posted the ant task in my reply to
Mike. For info this is from an "out-of-the-box" Netbeans Java
Application project - so I haven't been messing with the directory
structure or anything. My src/META-INF/persistance.xml is below;

<?xml version="1.0" encoding="UTF-8"?>
<persistence version="1.0"
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_1_0.xsd";>
  <persistence-unit name="FlashLoaderPU" transaction-type="RESOURCE_LOCAL">
    <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
    <class>com.blackbox.flashloader.entities.EcuDataIdentifiers</class>
    <class>com.blackbox.flashloader.entities.EcuDataIdentifiersPK</class>
    <class>com.blackbox.flashloader.entities.IvsEcu</class>
    <class>com.blackbox.flashloader.entities.IvsEcuPK</class>
    <class>com.blackbox.flashloader.entities.IvsPartsLink</class>
    <class>com.blackbox.flashloader.entities.IvsPartsLinkPK</class>
    <class>com.blackbox.flashloader.entities.Hardware</class>
    <class>com.blackbox.flashloader.entities.HardwarePK</class>
    <class>com.blackbox.flashloader.entities.PartsLink</class>
    <class>com.blackbox.flashloader.entities.PartsLinkPK</class>
    <class>com.blackbox.flashloader.entities.DataIdentifiers</class>
       <class>com.blackbox.flashloader.entities.DataIdentifiersPK</class>
   <class>com.blackbox.flashloader.entities.Model</class>
    <class>com.blackbox.flashloader.entities.IvsAssembly</class>
    <class>com.blackbox.flashloader.entities.IvsAssemblyPK</class>
    <class>com.blackbox.flashloader.entities.IvsSoftware</class>
        <class>com.blackbox.flashloader.entities.IvsSoftwarePK</class>
    <class>com.blackbox.flashloader.entities.Ecu</class>
    <class>com.blackbox.flashloader.entities.EcuPK</class>
    <class>com.blackbox.flashloader.entities.ServiceRules</class>
        <class>com.blackbox.flashloader.entities.ServiceRulesPK</class>
    <class>com.blackbox.flashloader.entities.QualifierRules</class>
        <class>com.blackbox.flashloader.entities.QualifierRulesPK</class>
    <class>com.blackbox.flashloader.entities.Swimparts</class>
    <class>com.blackbox.flashloader.entities.IvsHardware</class>
        <class>com.blackbox.flashloader.entities.IvsHardwarePK</class>
    <class>com.blackbox.flashloader.entities.Software</class>
    <class>com.blackbox.flashloader.entities.SoftwarePK</class>
    <class>com.blackbox.flashloader.entities.Assembly</class>
        <class>com.blackbox.flashloader.entities.AssemblyPK</class>
    <properties>
      <property name="openjpa.ConnectionPassword" value="password"/>
      <property name="openjpa.ConnectionDriverName"
value="com.mysql.jdbc.Driver"/>
      <property name="openjpa.ConnectionUserName" value="user"/>
      <property name="openjpa.ConnectionURL"
value="jdbc:mysql://localhost:3306/technical"/>
      <property name="openjpa.jdbc.SynchronizeMappings"
value="buildSchema(ForeignKeys=true)"/>
    </properties>
  </persistence-unit>
</persistence>


>
> On Tue, 16 Jun 2009 03:55:26 -0700 (PDT)
> "B.L. Zeebub" <[email protected]> wrote:
>
>>
>> Hi
>>
>> I've just spent the last three days wrestling with the enhancer and
>> I'm now ready to throw the computer out of a fifth floor window. I
>> spent the first day or so wrestling with error messages trying to
>> set-up the ant enhancer task in Netbeans 6.5.1/Linux (Debian Lenny).
>> (Googling for examples brought up many examples that were all
>> slightly different and none of them actually worked until I got
>> lucky). I finally got the process to run without falling over. I then
>> tried to run my first program. Next problem was that when the program
>> tried to create the EntityManagerFactory the program would crash
>> messages similair to "Caused by: <openjpa-1.2.1-r752877:753278 fatal
>> user
>> error> org.apache.openjpa.persistence.ArgumentException: The type
>> error> "class
>> com.mydomain.flashloader.entities.DataIdentifiersPK" has not been
>> enhanced."
>>
>> I've finally resolved that - I used Netbeans create entities from
>> database facility. Netbeans created a class for every table in the
>> database and a classPK file for every table that has multi-column
>> primary keys. However, it only put the table class entities into the
>> persistance.xml and omitted the classPK files. So I added all the
>> classPK classes into persistance xml, rebuilt the project and now my
>> program starts, creates the EntityManagerFactory without crashing.
>>
>> However, I'm left with a message during startup "1120  FlashLoaderPU
>> INFO [main] openjpa.Enhance - Creating subclass for "[<every entity
>> and entityPK in the database listed here>]" This means that your
>> application will be less efficient and will consume more memory than
>> it would if you ran the OpenJPA enhancer. Additionally, lazy loading
>> will not be available for one-to-one and many-to-one persistent
>> attributes in types using field access; they will be loaded eagerly
>> instead."
>>
>> So I seem to have spent the last three days going around in a complete
>> circle. I would be extremely grateful for any pointers as to what on
>> earth is going on.
>>
>> Regards
>
>

Reply via email to