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.  [ 21 posts ]  Go to page Previous  1, 2
Author Message
 Post subject:
PostPosted: Mon Jul 25, 2005 10:14 am 
Expert
Expert

Joined: Wed Apr 06, 2005 5:03 pm
Posts: 273
Location: Salt Lake City, Utah, USA
The posted code was just a modification to the existing DTDEntityResolver in Hibernate. URL and resourceLoader are already defined in that class. Of course, this was a while ago, so I don't know if that class has been modified since. Good luck. I gave up on the whole thing. I couldn't figure out any real clean way of getting it to work.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jan 10, 2008 6:29 am 
Newbie

Joined: Wed Jan 09, 2008 6:26 am
Posts: 19
If someone read this old post, it can be useful to know how to resolve the problem: you can use "classpath://" in your SYSTEM (since hibernate 3.2).


Top
 Profile  
 
 Post subject: Classpath protocol not working
PostPosted: Wed Jan 30, 2008 5:13 pm 
Newbie

Joined: Thu Nov 01, 2007 11:14 am
Posts: 5
Location: Austin, TX
I'm trying with "classpath://" in my SYSTEM and it's not working. I've got Hibernate 3.2 as specified. Are you sure this is ok? Where is it documented?

Also, I have a class (Address) that is sometimes used as a component (for example, when storying a Company, which only has a main address) and other times as a composite-element (when storing a Person, which has multiple addresses). Is there any way to keep the mapping definition of this element in only one file? The XML Entity include solution would require at least two (one for the component type and one for the composite element type).

Any solutions?


Top
 Profile  
 
 Post subject: Got classpath:// working
PostPosted: Wed Feb 13, 2008 12:53 am 
Newbie

Joined: Thu Nov 01, 2007 11:14 am
Posts: 5
Location: Austin, TX
I just wanted to say that I got classpath working. If Hibernate can't find something on the classpath, it gives you the error that the classpath protocol is not supported, rather than telling you it can't find that thing.

Back to the topic, I still haven't received a satisfactory answer to my question.

If I have, for instance, and "Address" class, a Person may have multiple addresses, so it makes sense to store them in an AddressType->Address map (using composite-element).

If I have a "RealEstateProperty" class, it represents a place, so has only one Address; a component.

I can't just make one Address mapping xml-entity file and include it; it needs to be either composite-element or component. So now I've got the same code in two places; bad.

Furthermore, if one class has more than one Address (say Mailing and Billing, stored separately), I can't use xml-entity at all: the column names would be specified in the external file and so would conflict if included twice.


Top
 Profile  
 
 Post subject: classpath Address
PostPosted: Fri Feb 29, 2008 1:00 pm 
Beginner
Beginner

Joined: Thu May 05, 2005 4:49 pm
Posts: 30
Jason,

It seems like the more you use Address in various contexts the more it becomes a standalone entity. Some classes have one instance, some two and some a collection. I bet the Hibernate guys would suggest you make it a standalone class with a table of its own and map it as a many-to-one.

Regarding the classpath thing, thanks for telling me about your error message, that was throwing me off for a while. I don't know why they didn't document this at all.


Top
 Profile  
 
 Post subject: This works in Hibernate 3.2
PostPosted: Wed Oct 08, 2008 11:13 am 
Newbie

Joined: Fri Nov 03, 2006 10:01 am
Posts: 6
For anybody that finds this old thread using Google, this has been resolved in Hibernate (I'm using 3.2). You can use classpath://someFile.xml.


Code:
<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-mapping PUBLIC
      "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
      "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"
      [ <!ENTITY paymentsItemProperties SYSTEM "classpath://payments-item.xml">       
      ]
  >



Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 21 posts ]  Go to page Previous  1, 2

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.