Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JBoss AS5 with Hibernate 3 annotations

 
Ashish Shinde
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

 
Jaikiran Pai
Marshal
Pie
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would recommend that you use the normal JPA spec specified jar deployment containing the persistence.xml. You can then additionally add the jboss.entity.manager.factory.jndi.name to the persistence.xml as explained here, to bind the entity manager factory in JNDI.
 
Ashish Shinde
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


I am not using EJB3 but JBoss with SOA.
Will this setting still work. My assumption is it will work as there is no relation to EJB3 here.
Please confirm.
Any good tutorial which will help me understand it would be helpful.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic