configuration disallows runtime optimization

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

configuration disallows runtime optimization

bigal.nz
Hello,

I am just getting started with JPA and running a small test to see if I can get everything configured correctly (and I can't).

The error I am getting when I try to submit a entity to the database is:

<openjpa-2.4.0-r422266:1674604 nonfatal user error> org.apache.openjpa.persistence.ArgumentException: This configuration disallows runtime optimization, but the following listed types were not enhanced at build time or at class load time with a javaagent: "
com.fh.SamEntity".

I am trying to build this in Intellij Idea. My persistence.xml is located at WEB-INF\classes\META-INF\persistence.xml and looks like:

<?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns="http://java.sun.com/xml/ns/persistence" version="2.0">

    <persistence-unit name="samDB">
        <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
        <class>com.fh.SamEntity</class>
        <properties>
            <property name="openjpa.ConnectionURL" value="jdbc:mysql://localhost:3306/sys"/>
            <property name="openjpa.ConnectionDriverName" value="com.mysql.jdbc.Driver"/>
            <property name="openjpa.ConnectionUserName" value="root"/>
            <property name="openjpa.ConnectionPassword" value="agg530"/>
            <property name="openjpa.Log" value="DefaultLevel=TRACE, Tool=INFO"/>
            <property name="openjpa.jdbc.SynchronizeMappings" value="buildSchema(ForeignKeys=true)"/>
        </properties>
    </persistence-unit>
</persistence>

For the most part it was auto generated by Idea - but I had to move it to \WEB-INF\classes as originally it was under \Main\Groovy\META-INF

My entity class looks like:

package com.fh;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import javax.persistence.*;
import java.sql.Date;

@JsonIgnoreProperties(ignoreUnknown = true)
@Entity
@Table(name = "sam", schema = "sys", catalog = "")
public class SamEntity {
    private int idSam;
    private Date startDate;
    private String address;
    private Date endDate;
    private Date attendDate;
....
....
....
   @Basic
    @Column(name = "StartDate")
    public Date getStartDate() {
        return startDate;
    }

    public void setStartDate(Date startDate) {
        this.startDate = startDate;
    }

    @Basic
    @Column(name = "Address")
    public String getAddress() {
        return address;
    }

...
...

And the actual code to write the object to the Db:

package com.fh;

import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.EntityTransaction;
import javax.persistence.Persistence;

public class harness {
    static void testHarness(SamEntity sam1) {
        EntityManagerFactory emf = Persistence.createEntityManagerFactory("samDB");
        EntityManager em = emf.createEntityManager();
        EntityTransaction tx = em.getTransaction();
        tx.begin();

        em.persist(sam1);
        tx.commit();
        em.close();

    }


Note that this project is a servlet.

Any assistance appreceated and thank you in advance,

-Al



Loading...