• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

JBoss AS5 with Hibernate 3 annotations

 
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.

 
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
reply
    Bookmark Topic Watch Topic
  • New Topic