-->
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: Ant integration requires bugfix for jar-based mapping files
PostPosted: Fri Jun 04, 2004 1:32 pm 
Newbie

Joined: Mon Feb 09, 2004 2:14 pm
Posts: 14
If you try to Hibernate (as of 2.1.4) with jar-file based mapping files as part of an Ant task, you will not be able to find the mapping jar file (unless it is added to the Ant classpath rather than the task class path). The problem is easily fixed with the following modification to Configuration.addJar (which mimics some of the addResource changes in 2.1.3 ff).

Code:
/**
* Read all mappings from a jar file
* @param resource an application resource (a jar file)
* @deprecated use <tt>addJar(java.io.File)</tt>
*/
public Configuration addJar(String resource) throws MappingException {
    URL url = Thread.currentThread().getContextClassLoader().getResource(resource);
    if (url == null) url = Environment.class.getClassLoader().getResource(resource);
    if (url == null) throw new MappingException( "Jar file: " + resource + " not found" );
    return addJar( new File( url.getFile() ));
}

This might effect other delegated classloader environments, not sure.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jun 04, 2004 1:50 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 3:00 pm
Posts: 1816
Location: Austin, TX
that version of addJar is deprecated


Top
 Profile  
 
 Post subject: True, but it's used internally
PostPosted: Fri Jun 04, 2004 2:02 pm 
Newbie

Joined: Mon Feb 09, 2004 2:14 pm
Posts: 14
steve wrote:
that version of addJar is deprecated


Uhh... OK, hadn't noticed that, but that is the one that is used when you specify a jar file in the hibernate properties file (hibernate.cfg.xml). I'm not calling it directly.

Does this mean that specifying a jar file in the properties file is deprecated? That would be a pity.


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.