-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 7 posts ] 
Author Message
 Post subject: Annotated classes not scanned
PostPosted: Fri Dec 22, 2006 8:24 am 
Newbie

Joined: Fri Dec 22, 2006 8:17 am
Posts: 6
My entities are annotated using @Entity. However, they are not recognized as entity beans if I don't define them in persistance.xml.

Here is my persistance.xml
Code:
<?xml version="1.0" encoding="UTF-8"?>
<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 http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
             version="1.0">
   
   <persistence-unit name="MysqlDBSource" transaction-type="RESOURCE_LOCAL" >
      <class>com.hello.User</class>
      <properties>
        <property name="hibernate.connection.driver_class" value="com.mysql.jdbc.Driver"/>
        <property name="hibernate.connection.url" value="jdbc:mysql://localhost:3306/test"/>
        <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect"/>
        <property name="hibernate.connection.username" value="root"/>
        <property name="hibernate.connection.password" value="admin"/>
        <property name="hibernate.max_fetch_depth" value="3"/>
        <property name="hibernate.hbm2ddl.auto" value="update"/>
        <property name="hibernate.show_sql" value="true"/>
        <property name="hibernate.cache.provider_class" value="org.hibernate.cache.HashtableCacheProvider"/>
      </properties>
   </persistence-unit>
   
</persistence>


If I don't declare com.hello.User here, it won't be detected by hibernate. Anyone knows?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Dec 22, 2006 2:31 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
what is your packaging?

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Fri Dec 22, 2006 6:18 pm 
Newbie

Joined: Fri Dec 22, 2006 8:17 am
Posts: 6
It's com.hello. Does it matter?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 27, 2006 10:50 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
not the package, the packaging (jar, META-INF etc)

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 28, 2006 9:10 am 
Newbie

Joined: Fri Dec 22, 2006 8:17 am
Posts: 6
I Used Seam1.1.0GA to generate a eclipse project, and I run the test inside eclipse. Seam uses hibernate-all.jar by default. I've removed other files from META-INF folder and it now only contains persistence.xml. I normal simply run SeamTest. SeamTest loads a lot of things that make it too slow. That's why I need a hibernate only environment to run some database related tests.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 03, 2007 5:35 pm 
Newbie

Joined: Fri Dec 15, 2006 11:09 am
Posts: 10
On a test project (I am exploring Hib3 annotations), I attempted to use the Hibernate "auto discovery' of xml files and annotated classes. I did not work for me either. When I enabled more Hibernate logging for log4j, I could then look at the resulting log file and see that it was doing the auto discovery, and it was looking into a different place than my xml and annotated files are. Possibly this same thing is happening for you. I do not yet know how to get the 'auto discovery' to widen its search, and I still thought adding this reply might help you. Good luck!

Jeff


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 03, 2007 5:43 pm 
Newbie

Joined: Fri Dec 15, 2006 11:09 am
Posts: 10
in case you have not seen it already, Java Persistence With Hibernate, sample chapter 2, page 76 has some info on this.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 7 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.