-->
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.  [ 1 post ] 
Author Message
 Post subject: How do I include another xml file in my hibernate xml file?
PostPosted: Mon Dec 03, 2012 12:13 pm 
Newbie

Joined: Mon Dec 03, 2012 10:48 am
Posts: 1
I would like to have two hibernate config files, one pointing at the master db and the other at the slave. Rather than spell out all of the tables twice, I'd like to specify the tables in its own file and include it in both config files.

I've tried using entities

Code:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
    "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"
    [ <!ENTITY targetfilename SYSTEM "targetfilename.xml"> ]>
<hibernate-configuration>
    <session-factory>
        &targetfilename;
    </session-factory>
</hibernate-configuration>

and although it is able to create the reference, it is trying to resolve the filename in my apache bin dir:

/Users/me/Environment/apache-tomcat-6.0.35/bin/targetfilename.xml

That's not workable, because the path is different on my local machine vs on my prod environment. The included file is in the same dir as the main hibernate config file.

I tried using the ./ in front of the filename, e.g.,

Code:
[ <!ENTITY targetfilename SYSTEM "./targetfilename.xml"> ]


but that doesn't work either.

I've also tried to use xi:include, but it seems not to be compatible with the hibernate xml DTD, because I get the error Attribute "xmlns" must be declared for element type "hibernate-configuration".

I would welcome any useful ideas. Thanks!


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

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.