Re: JPA/Hibernate entity auto discovery

2013-06-06 Thread Andrew Clarke
THANK YOU! This resolved my problem. I moved persistence.xml into WEB-INF/classes/META-INF, and suddenly it all worked. It was a beautiful moment. Thanks to all of you who responded. I'll provide some notes from my experiences below in case anyone else reads this later. jta-data-source

Re: JPA/Hibernate entity auto discovery

2013-06-06 Thread Romain Manni-Bucau
Hmm, jndi names work great so something might be wrong elsewhere. Would be great to identify it if thats true. Le 6 juin 2013 14:36, Andrew Clarke s...@clarke.ca a écrit : THANK YOU! This resolved my problem. I moved persistence.xml into WEB-INF/classes/META-INF, and suddenly it all worked.

JPA/Hibernate entity auto discovery

2013-06-05 Thread Andrew Clarke
I've set up my database in TomEE such that it works fine with SQL Query. When I attempted to do a simple entityManager.find() as a JPA test, I got the following error: java.lang.RuntimeException: org.apache.cxf.interceptor.Fault: The bean encountered a non-application exception; nested

Re: JPA/Hibernate entity auto discovery

2013-06-05 Thread John D. Ament
Andrew, Did you try using the setting exclude-unlisted-classes, with the value of false? John On Wed, Jun 5, 2013 at 8:27 PM, Andrew Clarke s...@clarke.ca wrote: I've set up my database in TomEE such that it works fine with SQL Query. When I attempted to do a simple entityManager.find() as

Re: JPA/Hibernate entity auto discovery

2013-06-05 Thread Andrew Clarke
Yes I did, thanks. I did mention that in the email, but I know there was a lot in there. This was the syntax of my persistence.xml when I tried that: persistence xmlns=http://java.sun.com/xml/ns/persistence; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;

Re: JPA/Hibernate entity auto discovery

2013-06-05 Thread John D. Ament
Hmm yeah I missed that part. So wait, is your persistence.xml in your war file somewhere? Where is it? How do you get a reference to your entity manager? On Wed, Jun 5, 2013 at 8:39 PM, Andrew Clarke s...@clarke.ca wrote: Yes I did, thanks. I did mention that in the email, but I know there

Re: JPA/Hibernate entity auto discovery

2013-06-05 Thread Andrew Clarke
Thanks again John. I'll include an example TestManagerBean.java below. My persistence.xml is in my WAR file under /META-INF. package com.example; import com.example.account.Application; import com.example.system.SystemPropertiesBean; import org.apache.commons.logging.Log; import

Re: JPA/Hibernate entity auto discovery

2013-06-05 Thread Howard W. Smith, Jr.
responses inline below... On Wed, Jun 5, 2013 at 8:27 PM, Andrew Clarke s...@clarke.ca wrote: 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

Re: JPA/Hibernate entity auto discovery

2013-06-05 Thread John D. Ament
So, the root META-INF? What happens when it goes in WEB-INF/classes/META-INF ? On Wed, Jun 5, 2013 at 9:29 PM, Andrew Clarke s...@clarke.ca wrote: Thanks again John. I'll include an example TestManagerBean.java below. My persistence.xml is in my WAR file under /META-INF. package

Re: JPA/Hibernate entity auto discovery

2013-06-05 Thread Howard W. Smith, Jr.
responses inline below... On Wed, Jun 5, 2013 at 8:27 PM, Andrew Clarke s...@clarke.ca wrote: 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

Re: JPA/Hibernate entity auto discovery

2013-06-05 Thread John D. Ament
Good catch, but AFAIK, Hibernate ignores the version of persistence.xml (typically). Unless TomEE cares... On Wed, Jun 5, 2013 at 9:39 PM, Howard W. Smith, Jr. smithh032...@gmail.com wrote: responses inline below... On Wed, Jun 5, 2013 at 8:27 PM, Andrew Clarke s...@clarke.ca wrote:

Re: JPA/Hibernate entity auto discovery

2013-06-05 Thread Jean-Louis MONTEIRO
Yes there is no difference afair in that area in jpa 2. Just to be sure, are you delivering hibernate within you webapp? By default, we use openjpa so you need hibernate in your webapp. As per the spec and again afair entities get detected and added automatically if and only if they are fine the