Hi. I'm trying to use Hibernate for the first time within JBoss AS 4.0.4. I'm
including hibernate-service.xml in my jboss-app.xml file in the META-INF
directory of my EAR and I have an ejb jar file included in the ear that
contains a mapping file. I have ScanForMappingsEnabled set to true in my
hibernate-service.xml file and I can see that that's working. When JBoss
starts, I can see in the server log that Hibernate is finding my mapping file.
However, I don't see any log messages about anything having been mapped and
when I attempt to execute a query from a SessionBean after retrieving the
current session from the SessionFactory, I'm told that the class I've mapped is
not mapped. I'm wondering if there's some ClassNotFoundException getting
swallowed during initialization or something like that. Here's some useful log
output:
from server.log:
2007-01-17 17:29:02,023 DEBUG [org.jboss.hibernate.jmx.Hibernate] Passing
archive
[/Applications/JBoss/jboss-4.0.4.GA/server/default/tmp/deploy/tmp53389myApp.ear-contents/myEntityEjb.jar]
to Hibernate Configration2007-01-17 17:29:02,023 INFO
[org.hibernate.cfg.Configuration] Searching for mapping documents in jar:
myEntityEjb.jar
2007-01-17 17:29:02,026 INFO [org.hibernate.cfg.Configuration] Found mapping
document in jar: com/my/hbm/model/InventoryItem.hbm.xml
2007-01-17 17:29:02,032 DEBUG [org.hibernate.util.DTDEntityResolver] trying to
resolve system-id [http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd]
2007-01-17 17:29:02,033 DEBUG [org.hibernate.util.DTDEntityResolver] recognized
hibernate namespace; attempting to resolve on classpath under org/hibernate/
2007-01-17 17:29:02,034 DEBUG [org.hibernate.util.DTDEntityResolver] located
[http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd] in classpath
2007-01-17 17:29:02,299 DEBUG [org.jboss.hibernate.jmx.Hibernate] Passing
archive
[/Applications/JBoss/jboss-4.0.4.GA/server/default/tmp/deploy/tmp53389nymVideo.ear-contents/memberEjb.jar]
to Hibernate Configration
I thought I'd see some output between the entries at 17:29:02,034 and
17:29:02,299 regarding what got mapped.
Here's my mapping file:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping
PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd" >
<hibernate-mapping>
inventoryItems_id_seq
</hibernate-mapping>
Here's the query from the Java code:
try {
Session hbmSession = MyHomeFactory.getMyInstance()
.lookupHibernateSessionFactory().getCurrentSession();
Query q = hbmSession.createQuery("from InventoryItem a
where a.productType = :pType");
q.setShort("pType", type);
answer = q.list();
int size = answer.size();
log.info("There are " + size + " inventory items of
type " + type + ".");
} catch (Exception e) {
.
.
.
}
I've tried setting priority value="TRACE" on org.hibernate in the log4j.xml
file to no effect.
Can anyone give me a clue as to how I can try to solve this problem?
Thanks
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4003075#4003075
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4003075
_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user