public HibernateUtil(ArgumentParser argumentParser, WebLogParser logParser) throws ExceptionInInitializerError, IOException, CannotCompileException, NotFoundException { try { /** Izbrisemo razrede, ki jih je uprabnik podal za ignoriranje */ List<LogFieldType> list = logParser.getFieldType(); if (logParser.getIgnoreFieldTypes() != null) { list.removeAll(logParser.getIgnoreFieldTypes()); } /** Inicializacija ClassLoaderja */ this.loader = initClassLoader(argumentParser); /** Nastavi dodatne lastnosti za Hibernate */ Properties props = initProperties(argumentParser); /** Nastavi nastavitve za Hibernate */ serviceRegistry = new StandardServiceRegistryBuilder() /** Dodaj nov ClassLoader Hibernatu */ .addService(ClassLoaderService.class, new ClassLoaderServiceImpl(loader)) /** Podaj nastavitve za Hibernate */ .applySettings(props) .build(); /** Posreduj potrebene razrede za izdelavo in delovanje podatkovne baze Hibernatu */ MetadataSources sources = new MetadataSources(serviceRegistry); for (Class c : initClasses(list, loader)) { sources.addAnnotatedClass(c); } /** Izdelaj podatkovno bazo */ factory = sources.buildMetadata().buildSessionFactory(); } catch (Exception e) { StandardServiceRegistryBuilder.destroy(serviceRegistry); throw new ExceptionInInitializerError(e); } }
/** * Constructs a BootstrapServiceRegistryImpl. * * Do not use directly generally speaking. Use {@link org.hibernate.boot.registry.BootstrapServiceRegistryBuilder} * instead. * * @see org.hibernate.boot.registry.BootstrapServiceRegistryBuilder */ public BootstrapServiceRegistryImpl() { this( new ClassLoaderServiceImpl(), NO_INTEGRATORS ); }