I am trying to integrate
JBoss AS5 with Hibernate 3 using annotations.
My requirement is to get SessionFactory through a JNDI lookup.
I tried the following link:
http://community.jboss.org/wiki/JBossHibernate3
I have completed following steps:
1. Created the *-ds.xml for creating the datasource and binding to JNDI.
2. Created annotated entity class (just one class for one table as start).
3. Created the *-hibernate.xml as follows:
This file has similar structure as hibernate.cfg.xml and placed in the <jboss-as>/default/deploy folder.
The above file throws an error during startup as:
org.jboss.xb.binding.JBossXBException: Failed to parse source: {urn:jboss:hibernate-deployer:1.0}mapping cannot appear in this position.
Expected content of {urn:jboss:hibernate-deployer:1.0}session-factory is unordered_sequence: {urn:jboss:hibernate-deployer:1.0}depends* {urn:jboss:hibernate-deployer:1.0}property*
It seems the <mapping> tag is not accepted under session-factory> and it works if I remove the <mapping> elements.
But the standard hibernate.cfg.xml does accept <mapping> under <session-factory>.
I do not have any *.hbm.xml as I want to use annotations.
Is there anything else I need to take care of or what is the correct way of doing it?
Any pointers or links would be helpful.