/** * Setting the configuration for the Uby database * * @param dbconfig * Database configuration of the Uby database * @deprecated marked for deletion */ @Deprecated public void setDbConfig(DBConfig dbconfig) throws FileNotFoundException{ this.dbConfig=dbconfig; cfg = HibernateConnect.getConfiguration(dbConfig); sessionFactory = cfg.buildSessionFactory(); openSession(); }
/** * Constructor for a {@link Uby} instance used for searching of different elements in a database * containing UBY-LMF {@link LexicalResource}. * * The connection to the database is specified using a {@link DBConfig} instance. * * @param dbConfig * configuration of the database containing UBY-LMF lexical resource. * @throws UbyInvalidArgumentException * if the specified dbConfig is null */ public Uby(DBConfig dbConfig) throws IllegalArgumentException { if(dbConfig == null) { throw new IllegalArgumentException("database configuration is null"); } this.dbConfig = dbConfig; cfg = HibernateConnect.getConfiguration(dbConfig); ServiceRegistryBuilder serviceRegistryBuilder = new ServiceRegistryBuilder() .applySettings(cfg.getProperties()); sessionFactory = cfg.buildSessionFactory(serviceRegistryBuilder.buildServiceRegistry()); openSession(); }