-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: inheritance: duplicate properties mapping
PostPosted: Wed Sep 21, 2005 11:35 am 
Newbie

Joined: Fri Jul 15, 2005 6:35 am
Posts: 12
In chapter 10 of official documentation I read:

"notice that properties of Payment are mapped in each of the subclasses. If you want to avoid duplication, consider using XML entities (e.g. [ <!ENTITY allproperties SYSTEM "allproperties.xml"> ] in the DOCTYPE declartion and &allproperties; in the mapping). "

Is not so clean for me. Is there an example somewere ?
Thank you.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 21, 2005 2:26 pm 
Pro
Pro

Joined: Fri Sep 02, 2005 4:21 am
Posts: 206
Location: Vienna
XML entities are XML, not Hibernate. I therefore kindly suggest that you google for XML entity - you'll find lots of links.

A good introduction I found was http://www.peej.co.uk/articles/xml-entities

Erik


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 20, 2006 8:47 am 
Newbie

Joined: Wed Sep 20, 2006 6:48 am
Posts: 4
May there be something wrong using ENTITIES in the mapping file?

My mapping-file (model.hbm.xml) works fine with the following mapping-file DOCTYPE (without ENTITY-declaration):
Code:
<!DOCTYPE hibernate-mapping PUBLIC
   "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
   "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">


Adding an ENTITY-entry brings a MappingException: Could not read mappings from resource: model.hbm.xml
The new DOCTYPE-declaration:
Code:
<!DOCTYPE hibernate-mapping PUBLIC
   "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
   "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd" [
   <!ENTITY gp SYSTEM "generic-properties.hbm.xml">
   ]>


The InternetExplorer reads the mapping-file without problems. If I include the "&gp;"-entity tag, the content of the generic-properties.hbm.xml-file is also included.
But Hibernate fails to startup everytime with the same error (Hibernate 3.1.3).
Maybe my ENTITY-declaration may be wrong but because it works with IE I think there might be a problem with the xml-parser...

Here the stacktrace:
Code:
org.hibernate.MappingException: Could not read mappings from resource: model.hbm.xml
   at org.hibernate.cfg.Configuration.addResource(Configuration.java:485)
   at org.hibernate.cfg.Configuration.parseMappingElement(Configuration.java:1465)
   at org.hibernate.cfg.Configuration.parseSessionFactory(Configuration.java:1433)
   at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1414)
   at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1390)
   at org.hibernate.cfg.Configuration.configure(Configuration.java:1310)
   at org.vgb.persistence.HibernateSessionFactory.rebuildSessionFactory(HibernateSessionFactory.java:66)


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.