org.hibernate.internal.CoreLogging Java Examples
The following examples show how to use
org.hibernate.internal.CoreLogging.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SqlClientPool.java From hibernate-reactive with GNU Lesser General Public License v2.1 | 6 votes |
private Driver findDriver(URI uri, ServiceConfigurationError originalError) { String scheme = uri.getScheme(); // "postgresql", "mysql", "db2", etc for (Driver d : ServiceLoader.load( Driver.class )) { String driverName = d.getClass().getCanonicalName(); CoreLogging.messageLogger(SqlClientPool.class).infof( "HRX000013: Detected driver [%s]", driverName ); if ("io.vertx.db2client.spi.DB2Driver".equals( driverName ) && "db2".equalsIgnoreCase( scheme )) { return d; } if ("io.vertx.mysqlclient.spi.MySQLDriver".equals( driverName ) && "mysql".equalsIgnoreCase( scheme )) { return d; } if ("io.vertx.pgclient.spi.PgDriver".equals( driverName ) && ("postgre".equalsIgnoreCase( scheme ) || "postgres".equalsIgnoreCase( scheme ) || "postgresql".equalsIgnoreCase( scheme ))) { return d; } } throw new ConfigurationException( "No suitable drivers found for URI scheme: " + scheme, originalError ); }
Example #2
Source File: ReactiveIntegrator.java From hibernate-reactive with GNU Lesser General Public License v2.1 | 6 votes |
private void attachEventContextManagingListenersIfRequired(SessionFactoryServiceRegistry serviceRegistry) { if ( ReactiveModeCheck.isReactiveRegistry( serviceRegistry ) ) { CoreLogging.messageLogger(ReactiveIntegrator.class).info("HRX000001: Hibernate Reactive Preview"); EventListenerRegistry eventListenerRegistry = serviceRegistry.getService( EventListenerRegistry.class ); eventListenerRegistry.addDuplicationStrategy( ReplacementDuplicationStrategy.INSTANCE ); eventListenerRegistry.getEventListenerGroup( EventType.AUTO_FLUSH ).appendListener( new DefaultReactiveAutoFlushEventListener() ); eventListenerRegistry.getEventListenerGroup( EventType.FLUSH ).appendListener( new DefaultReactiveFlushEventListener() ); eventListenerRegistry.getEventListenerGroup( EventType.FLUSH_ENTITY ).appendListener( new DefaultReactiveFlushEntityEventListener() ); eventListenerRegistry.getEventListenerGroup( EventType.PERSIST ).appendListener( new DefaultReactivePersistEventListener() ); eventListenerRegistry.getEventListenerGroup( EventType.PERSIST_ONFLUSH ).appendListener( new DefaultReactivePersistOnFlushEventListener() ); eventListenerRegistry.getEventListenerGroup( EventType.MERGE ).appendListener( new DefaultReactiveMergeEventListener() ); eventListenerRegistry.getEventListenerGroup( EventType.DELETE ).appendListener( new DefaultReactiveDeleteEventListener() ); eventListenerRegistry.getEventListenerGroup( EventType.REFRESH ).appendListener( new DefaultReactiveRefreshEventListener() ); eventListenerRegistry.getEventListenerGroup( EventType.LOCK ).appendListener( new DefaultReactiveLockEventListener() ); eventListenerRegistry.getEventListenerGroup( EventType.LOAD ).appendListener( new DefaultReactiveLoadEventListener() ); eventListenerRegistry.getEventListenerGroup( EventType.INIT_COLLECTION ).appendListener( new DefaultReactiveInitializeCollectionEventListener() ); } }
Example #3
Source File: SqlClientPool.java From hibernate-reactive with GNU Lesser General Public License v2.1 | 4 votes |
private URI jdbcUrl(Map configurationValues) { final String url = ConfigurationHelper.getString( Settings.URL, configurationValues ); CoreLogging.messageLogger(SqlClientPool.class).infof( "HRX000011: SQL Client URL [%s]", url ); return parse( url ); }
Example #4
Source File: SqlClientPool.java From hibernate-reactive with GNU Lesser General Public License v2.1 | 4 votes |
private SqlConnectOptions sqlConnectOptions(URI uri) { String scheme = uri.getScheme(); String database = uri.getPath().substring( 1 ); if ( scheme.equals("db2") && database.indexOf( ':' ) > 0 ) { database = database.substring( 0, database.indexOf( ':' ) ); } // FIXME: Check which values can be null String username = ConfigurationHelper.getString( Settings.USER, configurationValues ); String password = ConfigurationHelper.getString( Settings.PASS, configurationValues ); if (username==null || password==null) { String[] params = {}; // DB2 URLs are a bit odd and have the format: jdbc:db2://<HOST>:<PORT>/<DB>:key1=value1;key2=value2; if ( scheme.equals("db2") ) { int queryIndex = uri.getPath().indexOf(':') + 1; if (queryIndex > 0) { params = uri.getPath().substring(queryIndex).split(";"); } } else { params = uri.getQuery().split("&"); } for (String param : params) { if ( param.startsWith("user=") ) { username = param.substring(5); } if ( param.startsWith("pass=") ) { password = param.substring(5); } if ( param.startsWith("password=") ) { password = param.substring(9); } } } int port = uri.getPort(); if (port==-1) { switch (scheme) { case "postgresql": port = 5432; break; case "mysql": port = 3306; break; case "db2": port = 50000; break; } } SqlConnectOptions connectOptions = new SqlConnectOptions() .setHost( uri.getHost() ) .setPort( port ) .setDatabase( database ) .setUser( username ); if (password != null) { connectOptions.setPassword( password ); } //enable the prepared statement cache by default (except for DB2) connectOptions.setCachePreparedStatements( !scheme.equals("db2") ); final Integer cacheMaxSize = ConfigurationHelper.getInteger( Settings.PREPARED_STATEMENT_CACHE_MAX_SIZE, configurationValues ); if (cacheMaxSize!=null) { if (cacheMaxSize <= 0) { CoreLogging.messageLogger(SqlClientPool.class).infof( "HRX000014: Prepared statement cache disabled", cacheMaxSize ); connectOptions.setCachePreparedStatements(false); } else { CoreLogging.messageLogger(SqlClientPool.class).infof( "HRX000015: Prepared statement cache max size: %d", cacheMaxSize ); connectOptions.setCachePreparedStatements(true); connectOptions.setPreparedStatementCacheMaxSize(cacheMaxSize); } } final Integer sqlLimit = ConfigurationHelper.getInteger( Settings.PREPARED_STATEMENT_CACHE_SQL_LIMIT, configurationValues ); if (sqlLimit!=null) { CoreLogging.messageLogger(SqlClientPool.class).infof( "HRX000016: Prepared statement cache SQL limit: %d", sqlLimit ); connectOptions.setPreparedStatementCacheSqlLimit(sqlLimit); } return connectOptions; }