1 Reply Latest reply on Dec 30, 2005 9:18 PM by epbernard

    Quick and dirty patch

    pprados

      I propose to add in Configuration class in hibernate :

      class Configuration ...
      { ...
      public Configuration addPar(File par) throws MappingException
      {
       log.info("Searching for mapping documents in par: " + par.getName());
       JarFile parFile = null;
       try
       {
       try
       {
       parFile = new JarFile(par);
       }
       catch (IOException ioe)
       {
       throw new MappingException("Could not read mapping documents from jar: "
       + par.getName(), ioe);
       }
       Enumeration jarEntries = parFile.entries();
       do
       {
       if (!jarEntries.hasMoreElements())
       break;
       ZipEntry ze = (ZipEntry) jarEntries.nextElement();
       if (ze.getName().endsWith(".class"))
       {
       try
       {
       String classname = ze.getName();
       classname = classname.substring(0, classname.length() - 6)
       .replace('/', '.');
       log.info("Found class in jar: " + classname);
       addClass(Class.forName(classname));
       }
       catch (Exception e)
       {
       throw new MappingException(
       "Could not read mapping class from par: " + par.getName(), e);
       }
       }
       } while (true);
       }
       finally
       {
       try
       {
       if (parFile != null)
       parFile.close();
       }
       catch (IOException ioe)
       {
       log.error("could not close jar", ioe);
       }
       }
       return this;
      }
      ...
      }
      

      And, it must necessary to update the DTD and the parser. If I found the time, I will propose a patch.