Q: entityManager.find only works if the entity has just the id field (OpenJpa, Apache Tomee 1.7) I'm using Apache Tomme 1.7.
I have two entities, Autor and Livro, with a ManyToMany relationship. If my entities have only an Id field, I can perform findAll, findOne and update normally, using a generic dao. 
The problem is that if I try to add other field, like "name" to one entity, update and findOne stop working!
I have the following entities:
Autor:
@Entity
public class Autor {
    @Id
    @GeneratedValue
    private Long id;
    @ManyToMany(mappedBy="autores", cascade = CascadeType.ALL)
    private Collection<Livro> livros;

    public Autor(){
        this.livros = new ArrayList<Livro>();
    }

   //Getters and setters

}

Livro:
@Entity
public class Livro {
    @Id
    @GeneratedValue
    private Long id;
    @ManyToMany(fetch=FetchType.EAGER, cascade = CascadeType.ALL)
    private Collection<Autor> autores;

    @Column(name = "nome")
    private String nome;

    public Livro(){
        this.autores = new ArrayList<Autor>();
    }

     //Getters and setters

}

My generic DAO:
public abstract class AbstractJpaDao< T > {

    private Class< T > clazz;

    @PersistenceContext(unitName = "userDatabase")
    EntityManager entityManager;

    public final void setClazz( Class< T > clazzToSet ){
        this.clazz = clazzToSet;
    }

    public T findOne(long id){
        return entityManager.find( clazz, id );
    }
    @SuppressWarnings("unchecked")
    public List< T > findAll(){
        return entityManager.createQuery(" SELECT u FROM " + clazz.getName() + " u" ).getResultList();
    }

    public void create( T entity ){
        entityManager.persist( entity );
    }

    public T update( T entity ){
        return entityManager.merge(entity);
    }

    public void delete( T entity ){
        entityManager.remove(entityManager.merge(entity));
    }
    public void deleteById( long entityId ){
        T entity = findOne( entityId );
        delete( entity );
    }
}

My DAO's:
public class LivroDao extends AbstractJpaDao<Livro> {

    public LivroDao(){
        setClazz(Livro.class);
    }


public class AutorDao extends AbstractJpaDao<Autor> {
    public AutorDao(){
        setClazz(Autor.class);
    }
}

Then I have one Stateless Service:
@Stateless
public class LivroService {
    @Inject
    private LivroDao livroDao;

    public void adiciona(Livro livro){
        livroDao.create(livro);
    }
    public Livro findOne(Long id){
        return livroDao.findOne(id);
    }
    public List<Livro> findAll(){
        return livroDao.findAll();
    }
    public void atualiza(Livro livro) {
        livroDao.update(livro);

    }
}

And finally my ManagedBean:
@ManagedBean (name = "testaBean")
public class TestaBean {
    @Inject
    private LivroService livroService;
    public void find(){
        Long idToFind = livroService.findAll().get(0).getId();
        Livro livro = livroService.findOne(idToFind);
        System.out.println(livro);
    }
}

When I try to call find() from some .xhtml file, I got the following error in the console:
9386  userDatabase  INFO   [http-bio-8080-exec-8] openjpa.Runtime - Starting OpenJPA 2.4.0-nonfinal-1598334
9823  userDatabase  TRACE  [http-bio-8080-exec-8] openjpa.jdbc.SQL - <t 396837323, conn 315308390> executing stmnt 288599461 ALTER TABLE Livro ADD nome VARCHAR(255)
9889  userDatabase  TRACE  [http-bio-8080-exec-8] openjpa.jdbc.SQL - <t 396837323, conn 315308390> [66 ms] spent
9934  userDatabase  WARN   [http-bio-8080-exec-8] openjpa.Enhance - Creating subclass for "[class entities.Livro, class entities.Autor]". 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.
10223  userDatabase  TRACE  [http-bio-8080-exec-8] openjpa.jdbc.SQL - <t 396837323, conn 1505136323> executing prepstmnt 827552192 SELECT t0.id, t0.nome FROM Livro t0
10223  userDatabase  TRACE  [http-bio-8080-exec-8] openjpa.jdbc.SQL - <t 396837323, conn 1505136323> [0 ms] spent
10264  userDatabase  TRACE  [http-bio-8080-exec-8] openjpa.jdbc.SQL - <t 396837323, conn 1505136323> executing prepstmnt 1936078582 SELECT t1.id FROM Livro_Autor t0 INNER JOIN Autor t1 ON t0.AUTORES_ID = t1.id WHERE t0.LIVROS_ID = ? [params=?]
10264  userDatabase  TRACE  [http-bio-8080-exec-8] openjpa.jdbc.SQL - <t 396837323, conn 1505136323> [0 ms] spent
10291  userDatabase  TRACE  [http-bio-8080-exec-8] openjpa.jdbc.SQL - <t 396837323, conn 1505136323> executing prepstmnt 1305537666 UPDATE Livro SET nome = ? WHERE id = ? [params=?, ?]
10328  userDatabase  TRACE  [http-bio-8080-exec-8] openjpa.jdbc.SQL - <t 396837323, conn 1505136323> [37 ms] spent
10346  userDatabase  TRACE  [http-bio-8080-exec-8] openjpa.jdbc.SQL - <t 396837323, conn 337295443> executing prepstmnt 1454078729 SELECT t0.nome, t1.LIVROS_ID, t2.id FROM Livro t0 LEFT OUTER JOIN Livro_Autor t1 ON t0.id = t1.LIVROS_ID LEFT OUTER JOIN Autor t2 ON t1.AUTORES_ID = t2.id WHERE t0.id = ? ORDER BY t1.LIVROS_ID ASC [params=?]
10347  userDatabase  TRACE  [http-bio-8080-exec-8] openjpa.jdbc.SQL - <t 396837323, conn 337295443> [0 ms] spent
Out 09, 2014 3:47:16 PM org.apache.openejb.core.transaction.EjbTransactionUtil handleSystemException
SEVERE: EjbTransactionUtil.handleSystemException: null
<openjpa-2.4.0-nonfinal-1598334-r422266:1599166 nonfatal general error> org.apache.openjpa.persistence.PersistenceException: null
FailedObject: 4251 [org.apache.openjpa.util.LongId] [java.lang.String]
    at org.apache.openjpa.kernel.BrokerImpl.find(BrokerImpl.java:1031)
    at org.apache.openjpa.kernel.BrokerImpl.find(BrokerImpl.java:925)
    at org.apache.openjpa.kernel.DelegatingBroker.find(DelegatingBroker.java:231)
    at org.apache.openjpa.persistence.EntityManagerImpl.find(EntityManagerImpl.java:487)
    at org.apache.openejb.persistence.JtaEntityManager.find(JtaEntityManager.java:175)
    at dao.AbstractJpaDao.findOne(AbstractJpaDao.java:20)
    at service.LivroService.findOne(LivroService.java:22)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.apache.openejb.core.interceptor.ReflectionInvocationContext$Invocation.invoke(ReflectionInvocationContext.java:192)
    at org.apache.openejb.core.interceptor.ReflectionInvocationContext.proceed(ReflectionInvocationContext.java:173)
    at org.apache.openejb.monitoring.StatsInterceptor.record(StatsInterceptor.java:181)
    at org.apache.openejb.monitoring.StatsInterceptor.invoke(StatsInterceptor.java:100)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.apache.openejb.core.interceptor.ReflectionInvocationContext$Invocation.invoke(ReflectionInvocationContext.java:192)
    at org.apache.openejb.core.interceptor.ReflectionInvocationContext.proceed(ReflectionInvocationContext.java:173)
    at org.apache.openejb.core.interceptor.InterceptorStack.invoke(InterceptorStack.java:85)
    at org.apache.openejb.core.stateless.StatelessContainer._invoke(StatelessContainer.java:227)
    at org.apache.openejb.core.stateless.StatelessContainer.invoke(StatelessContainer.java:194)
    at org.apache.openejb.core.ivm.EjbObjectProxyHandler.synchronizedBusinessMethod(EjbObjectProxyHandler.java:308)
    at org.apache.openejb.core.ivm.EjbObjectProxyHandler.businessMethod(EjbObjectProxyHandler.java:303)
    at org.apache.openejb.core.ivm.EjbObjectProxyHandler._invoke(EjbObjectProxyHandler.java:92)
    at org.apache.openejb.core.ivm.BaseEjbProxyHandler.invoke(BaseEjbProxyHandler.java:308)
    at service.LivroService$$LocalBeanProxy.findOne(service/LivroService.java)
    at beans.TestaBean.find(TestaBean.java:37)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.apache.el.parser.AstValue.invoke(AstValue.java:278)
    at org.apache.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:273)
    at com.sun.faces.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:105)
    at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:87)
    at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102)
    at javax.faces.component.UICommand.broadcast(UICommand.java:315)
    at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:790)
    at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1282)
    at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:81)
    at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
    at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:198)
    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:646)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
    at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
    at org.apache.tomee.catalina.OpenEJBValve.invoke(OpenEJBValve.java:44)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1070)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:611)
    at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:316)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.NullPointerException
    at org.apache.openjpa.jdbc.kernel.JDBCStoreManager.setInverseRelation(JDBCStoreManager.java:453)
    at org.apache.openjpa.jdbc.kernel.JDBCStoreManager.initializeState(JDBCStoreManager.java:413)
    at org.apache.openjpa.jdbc.kernel.JDBCStoreManager.initialize(JDBCStoreManager.java:306)
    at org.apache.openjpa.kernel.DelegatingStoreManager.initialize(DelegatingStoreManager.java:112)
    at org.apache.openjpa.kernel.ROPStoreManager.initialize(ROPStoreManager.java:57)
    at org.apache.openjpa.kernel.BrokerImpl.initialize(BrokerImpl.java:1050)
    at org.apache.openjpa.kernel.BrokerImpl.find(BrokerImpl.java:1008)
    ... 66 more

Out 09, 2014 3:47:16 PM com.sun.faces.lifecycle.InvokeApplicationPhase execute
WARNING: #{testaBean.find}: javax.ejb.EJBException: The bean encountered a non-application exception; nested exception is: 
    <openjpa-2.4.0-nonfinal-1598334-r422266:1599166 nonfatal general error> org.apache.openjpa.persistence.PersistenceException: null
FailedObject: 4251 [org.apache.openjpa.util.LongId] [java.lang.String]
javax.faces.FacesException: #{testaBean.find}: javax.ejb.EJBException: The bean encountered a non-application exception; nested exception is: 
    <openjpa-2.4.0-nonfinal-1598334-r422266:1599166 nonfatal general error> org.apache.openjpa.persistence.PersistenceException: null
FailedObject: 4251 [org.apache.openjpa.util.LongId] [java.lang.String]
    at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:118)
    at javax.faces.component.UICommand.broadcast(UICommand.java:315)
    at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:790)
    at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1282)
    at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:81)
    at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
    at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:198)
    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:646)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
    at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
    at org.apache.tomee.catalina.OpenEJBValve.invoke(OpenEJBValve.java:44)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1070)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:611)
    at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:316)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    at java.lang.Thread.run(Unknown Source)
Caused by: javax.faces.el.EvaluationException: javax.ejb.EJBException: The bean encountered a non-application exception; nested exception is: 
    <openjpa-2.4.0-nonfinal-1598334-r422266:1599166 nonfatal general error> org.apache.openjpa.persistence.PersistenceException: null
FailedObject: 4251 [org.apache.openjpa.util.LongId] [java.lang.String]
    at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:101)
    at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102)
    ... 28 more
Caused by: javax.ejb.EJBException: The bean encountered a non-application exception; nested exception is: 
    <openjpa-2.4.0-nonfinal-1598334-r422266:1599166 nonfatal general error> org.apache.openjpa.persistence.PersistenceException: null
FailedObject: 4251 [org.apache.openjpa.util.LongId] [java.lang.String]
    at org.apache.openejb.core.ivm.BaseEjbProxyHandler.convertException(BaseEjbProxyHandler.java:408)
    at org.apache.openejb.core.ivm.BaseEjbProxyHandler.invoke(BaseEjbProxyHandler.java:312)
    at service.LivroService$$LocalBeanProxy.findOne(service/LivroService.java)
    at beans.TestaBean.find(TestaBean.java:37)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.apache.el.parser.AstValue.invoke(AstValue.java:278)
    at org.apache.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:273)
    at com.sun.faces.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:105)
    at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:87)
    ... 29 more
Caused by: <openjpa-2.4.0-nonfinal-1598334-r422266:1599166 nonfatal general error> org.apache.openjpa.persistence.PersistenceException: null
FailedObject: 4251 [org.apache.openjpa.util.LongId] [java.lang.String]
    at org.apache.openjpa.kernel.BrokerImpl.find(BrokerImpl.java:1031)
    at org.apache.openjpa.kernel.BrokerImpl.find(BrokerImpl.java:925)
    at org.apache.openjpa.kernel.DelegatingBroker.find(DelegatingBroker.java:231)
    at org.apache.openjpa.persistence.EntityManagerImpl.find(EntityManagerImpl.java:487)
    at org.apache.openejb.persistence.JtaEntityManager.find(JtaEntityManager.java:175)
    at dao.AbstractJpaDao.findOne(AbstractJpaDao.java:20)
    at service.LivroService.findOne(LivroService.java:22)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.apache.openejb.core.interceptor.ReflectionInvocationContext$Invocation.invoke(ReflectionInvocationContext.java:192)
    at org.apache.openejb.core.interceptor.ReflectionInvocationContext.proceed(ReflectionInvocationContext.java:173)
    at org.apache.openejb.monitoring.StatsInterceptor.record(StatsInterceptor.java:181)
    at org.apache.openejb.monitoring.StatsInterceptor.invoke(StatsInterceptor.java:100)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.apache.openejb.core.interceptor.ReflectionInvocationContext$Invocation.invoke(ReflectionInvocationContext.java:192)
    at org.apache.openejb.core.interceptor.ReflectionInvocationContext.proceed(ReflectionInvocationContext.java:173)
    at org.apache.openejb.core.interceptor.InterceptorStack.invoke(InterceptorStack.java:85)
    at org.apache.openejb.core.stateless.StatelessContainer._invoke(StatelessContainer.java:227)
    at org.apache.openejb.core.stateless.StatelessContainer.invoke(StatelessContainer.java:194)
    at org.apache.openejb.core.ivm.EjbObjectProxyHandler.synchronizedBusinessMethod(EjbObjectProxyHandler.java:308)
    at org.apache.openejb.core.ivm.EjbObjectProxyHandler.businessMethod(EjbObjectProxyHandler.java:303)
    at org.apache.openejb.core.ivm.EjbObjectProxyHandler._invoke(EjbObjectProxyHandler.java:92)
    at org.apache.openejb.core.ivm.BaseEjbProxyHandler.invoke(BaseEjbProxyHandler.java:308)
    ... 39 more
Caused by: java.lang.NullPointerException
    at org.apache.openjpa.jdbc.kernel.JDBCStoreManager.setInverseRelation(JDBCStoreManager.java:453)
    at org.apache.openjpa.jdbc.kernel.JDBCStoreManager.initializeState(JDBCStoreManager.java:413)
    at org.apache.openjpa.jdbc.kernel.JDBCStoreManager.initialize(JDBCStoreManager.java:306)
    at org.apache.openjpa.kernel.DelegatingStoreManager.initialize(DelegatingStoreManager.java:112)
    at org.apache.openjpa.kernel.ROPStoreManager.initialize(ROPStoreManager.java:57)
    at org.apache.openjpa.kernel.BrokerImpl.initialize(BrokerImpl.java:1050)
    at org.apache.openjpa.kernel.BrokerImpl.find(BrokerImpl.java:1008)
    ... 66 more

But again, If I remove the "nome" field, everything works just fine! What is the problem?
My persistence.xml
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.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_2_0.xsd">

    <persistence-unit name="userDatabase" transaction-type="JTA">
        <jta-data-source>userDatabase</jta-data-source>
        <properties>
            <property name="openjpa.Log" value="DefaultLevel=WARN, Runtime=INFO, Tool=INFO, SQL=TRACE"/>
             <!-- Adicionar SQL=TRACE para ver os SQL Statements 
             http://openjpa.apache.org/builds/1.0.2/apache-openjpa-1.0.2/docs/manual/ref_guide_logging_openjpa.html
             -->
            <property name="openjpa.jdbc.SynchronizeMappings" value="buildSchema"/>
            <property name="openjpa.jdbc.SchemaFactory" value="native(ForeignKeys=true)" />

            <!-- http://openjpa.apache.org/builds/1.0.2/apache-openjpa-1.0.2/docs/manual/ref_guide_perfpack_eager.html -->
            <property name="openjpa.jdbc.EagerFetchMode" value="join"/>
        </properties>
    </persistence-unit>
</persistence>

And my tomee.xml file:
  <?xml version="1.0" encoding="UTF-8"?>
    <tomee>
      <!-- see http://tomee.apache.org/containers-and-resources.html -->

      <!-- activate next line to be able to deploy applications in apps -->
      <!-- <Deployments dir="apps" /> -->
    <Resource id="userDatabase" type="DataSource">
        JdbcDriver  com.mysql.jdbc.Driver 
        JdbcUrl jdbc:mysql://localhost:3306/projeto_bim
        UserName    root
        Password    123
        JtaManaged  true
    </Resource>
    </tomee>


A: I'm somewhat confused by your post.

openjpa.Enhance - Creating subclass for "[class entities.Livro, class entities.Autor]". 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.

This message means that your Entities are not enhanced, and for whatever reason the TomEE container hooks didn't perform the enhancement for you. What I don't understand is that you don't have openjpa.RuntimeUnenhancedClasses=supported in your persistence.xml. That property enables this (broken) feature. If for some reason you omitted that property somehow, please remove it and read the OpenJPA documentation on how to properly enhance your Entities.

A: TomEE does set RuntimeUnenhancedClasses to supported if not specified mainly for historical reason and embedded tests
