Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

orm.xml with JBoss

 
Mirko Bonasorte
Ranch Hand
Posts: 244
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I'm trying to use persistence with JBoss, but I get an error about the validation of jboss.xml.
Here it is my details:
 
Mirko Bonasorte
Ranch Hand
Posts: 244
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys,
it seems to be a bug.
Here it's the link to Hibernate bug tracker.
It seems to happen when using both annotations and orm.xml.
In fact, in my projects I had created two jars, one with annotations and another one without.
 
Jaikiran Pai
Marshal
Pie
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Mirko Bonasorte:


Here it is my details:


There's a problem with the contents of your orm.xml file:

<entity-mappings version="1.0">

Change this to


I tried with the orm.xml that you posted and got the same error as the one you got. I then changed the entity-mappings declaration as above and got it working.
 
Mirko Bonasorte
Ranch Hand
Posts: 244
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Jaikiran!

So, the schema location seems to be mandatory... But the O'Reilly book does not make any mention about it.
According to you, it is an error of the book or an Hibernate bug?

Thanks a lot!
 
Jaikiran Pai
Marshal
Pie
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Mirko Bonasorte:
According to you, it is an error of the book or an Hibernate bug?


I wouldn't call it a bug in Hibernate. Looks like the book missed out on that definition. Hibernate does make a mention about adding the schema declaration for persistence.xml (i would consider, it holds true for orm.xml too):


Be sure to define the grammar definition in the persistence element since the EJB3 specification requires the schema validation


<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">

[ October 30, 2007: Message edited by: Jaikiran Pai ]
 
Mirko Bonasorte
Ranch Hand
Posts: 244
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
it works!

Thanks for the support!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic