-
1. Re: Hibernate entities are not automatically scanned
jaikiran Jul 2, 2010 2:34 AM (in response to lexsoto)You don't have to explicitly map the entitites in the persistence.xml. Where exactly have you placed the persistence.xml (within the EJB jar)? And please post a sample Entity class (including the annotation and the import statements).
-
2. Re: Hibernate entities are not automatically scanned
lexsoto Jul 2, 2010 9:50 AM (in response to jaikiran)Hello Jaikiran,
Thank you for the reply.
My persistence.xml is in the META-INF directory of the EJB jar.
My entities look like this:
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
@Table(name="TBL_AFFILIATES")
@Entity(name="Affiliate")
public class Affiliate implements java.io.Serializable {
....
I hope this helps. Let me know if you need more information.
Are there log4j categories I need to tweak to help troubleshot this?
I was also trying to find the example apps in the JBoss downloads section but could find any sample app to compare.
The documentation talks about a TODO application, where can I find it?
Thanks,
Alex Soto
-
3. Re: Hibernate entities are not automatically scanned
jaikiran Jul 2, 2010 10:04 AM (in response to lexsoto)alex soto wrote:
My persistence.xml is in the META-INF directory of the EJB jar.
My entities look like this:
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
@Table(name="TBL_AFFILIATES")
@Entity(name="Affiliate")
public class Affiliate implements java.io.Serializable {
....
I don't see any obvious reason why this won't work. The code and the location of the file looks fine. Can you also post the persistence.xml file? Also are you packaging any hibernate jars or any jar file(s) containing javax.persistence.* in your application? If yes, then try removing those.
alex soto wrote:
Changing org.hibernate category to something like DEBUG might help.
alex soto wrote:
I was also trying to find the example apps in the JBoss downloads section but could find any sample app to compare.
The documentation talks about a TODO application, where can I find it?
The TODO example no longer exists, AFAIK. We however do have some tutorials here http://jboss.org/ejb3/docs
-
4. Re: Hibernate entities are not automatically scanned
lexsoto Jul 2, 2010 11:12 AM (in response to jaikiran)I found what the problem is:
If the data source file (ecomm-ds.xml) is in the deploy directory (outside of the EAR) it works.
If the datasource is included inside the EAR file, then it does not work.
I was trying to get the data source deployed as part of the EAR.
My "META-INF/jobss-app.xml" looks like this:
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE jboss-app PUBLIC "-//JBoss//DTD Java EE Application 5.0//EN" "http://www.jboss.org/j2ee/dtd/jboss-app_5_0.dtd"> <jboss-app> <module> <service>ecomm-ds.xml</service> </module> </jboss-app>
The ecomm-ds.xml file is in the root of the EAR.
Am I doing something wrong?
Thanks,
Alex Soto
-
5. Re: Hibernate entities are not automatically scanned
jaikiran Jul 2, 2010 1:08 PM (in response to lexsoto)That should have worked. Are there any error/exceptions when it doesn't work? Also please post the persistence.xml file.
-
6. Re: Hibernate entities are not automatically scanned
lexsoto Jul 2, 2010 1:37 PM (in response to jaikiran)There are no evident errors that I could notice.
Attached is my persistence.xml file.
-
persistence.xml 1.8 KB
-
-
7. Re: Hibernate entities are not automatically scanned
jaikiran Jul 7, 2010 3:25 AM (in response to lexsoto)I think I know what the issue is. But I would have expected an exception/error during the deployment. So I am not 100% sure of what's going on. Please attach your server.log for both the cases (one where you see the issue and the other where you explicitly specify the classes).