Java 类org.hibernate.service.UnknownUnwrapTypeException 实例源码

项目:HikariCP    文件:TestHibernate.java   
@Test
public void testConnectionProvider() throws Exception
{
   HikariConnectionProvider provider = new HikariConnectionProvider();

   Properties props = new Properties();
   props.load(getClass().getResourceAsStream("/hibernate.properties"));

   provider.configure(props);
   Connection connection = provider.getConnection();
   provider.closeConnection(connection);

   Assert.assertNotNull(provider.unwrap(HikariConnectionProvider.class));
   Assert.assertFalse(provider.supportsAggressiveRelease());

   try {
      provider.unwrap(TestHibernate.class);
      Assert.fail("Expected exception");
   }
   catch (UnknownUnwrapTypeException e) {
   }

   provider.stop();
}
项目:incubator-netbeans    文件:CustomJDBCConnectionProvider.java   
@Override
  public <T> T unwrap(Class<T> unwrapType) {
      if (ConnectionProvider.class.equals(unwrapType) ||
              CustomJDBCConnectionProvider.class.isAssignableFrom(unwrapType)) {
          return (T) this;
      } else {
          throw new UnknownUnwrapTypeException( unwrapType );
      }
}
项目:lams    文件:AbstractMultiTenantConnectionProvider.java   
@Override
@SuppressWarnings( {"unchecked"})
public <T> T unwrap(Class<T> unwrapType) {
    if ( isUnwrappableAs( unwrapType ) ) {
        return (T) this;
    }
    else {
        throw new UnknownUnwrapTypeException( unwrapType );
    }
}
项目:lams    文件:AbstractDataSourceBasedMultiTenantConnectionProviderImpl.java   
@Override
@SuppressWarnings( {"unchecked"})
public <T> T unwrap(Class<T> unwrapType) {
    if ( isUnwrappableAs( unwrapType ) ) {
        return (T) this;
    }
    else {
        throw new UnknownUnwrapTypeException( unwrapType );
    }
}
项目:lams    文件:DriverManagerConnectionProviderImpl.java   
@Override
@SuppressWarnings( {"unchecked"})
public <T> T unwrap(Class<T> unwrapType) {
    if ( ConnectionProvider.class.equals( unwrapType ) ||
            DriverManagerConnectionProviderImpl.class.isAssignableFrom( unwrapType ) ) {
        return (T) this;
    }
    else {
        throw new UnknownUnwrapTypeException( unwrapType );
    }
}
项目:lams    文件:UserSuppliedConnectionProviderImpl.java   
@Override
@SuppressWarnings( {"unchecked"})
public <T> T unwrap(Class<T> unwrapType) {
    if ( ConnectionProvider.class.equals( unwrapType ) ||
            UserSuppliedConnectionProviderImpl.class.isAssignableFrom( unwrapType ) ) {
        return (T) this;
    }
    else {
        throw new UnknownUnwrapTypeException( unwrapType );
    }
}
项目:lams    文件:DatasourceConnectionProviderImpl.java   
@Override
@SuppressWarnings( {"unchecked"})
public <T> T unwrap(Class<T> unwrapType) {
    if ( ConnectionProvider.class.equals( unwrapType ) ||
            DatasourceConnectionProviderImpl.class.isAssignableFrom( unwrapType ) ) {
        return (T) this;
    }
    else if ( DataSource.class.isAssignableFrom( unwrapType ) ) {
        return (T) getDataSource();
    }
    else {
        throw new UnknownUnwrapTypeException( unwrapType );
    }
}
项目:postguice    文件:DBCPConnectionProvider.java   
@Override
@SuppressWarnings("unchecked")
public <T> T unwrap(Class<T> unwrapType) {
    if (ConnectionProvider.class.equals(unwrapType) || DBCPConnectionProvider.class.isAssignableFrom(unwrapType)) {
        return (T) this;
    }
    if (DataSource.class.isAssignableFrom(unwrapType)) {
        return (T) this.dataSource;
    }
    throw new UnknownUnwrapTypeException(unwrapType);
}
项目:HikariCP    文件:HikariConnectionProvider.java   
@Override
@SuppressWarnings("unchecked")
public <T> T unwrap(Class<T> unwrapType)
{
    if ( ConnectionProvider.class.equals( unwrapType ) ||
            HikariConnectionProvider.class.isAssignableFrom( unwrapType ) ) {
        return (T) this;
    }
    else if ( DataSource.class.isAssignableFrom( unwrapType ) ) {
        return (T) this.hds;
    }
    else {
        throw new UnknownUnwrapTypeException( unwrapType );
    }
}
项目:invesdwin-context-persistence    文件:BeanLookupDatasourceConnectionProvider.java   
@Override
@SuppressWarnings({ "unchecked" })
public <T> T unwrap(final Class<T> unwrapType) {
    if (ConnectionProvider.class.equals(unwrapType)
            || BeanLookupDatasourceConnectionProvider.class.isAssignableFrom(unwrapType)) {
        return (T) this;
    } else if (DataSource.class.isAssignableFrom(unwrapType)) {
        return (T) dataSource;
    } else {
        throw new UnknownUnwrapTypeException(unwrapType);
    }
}
项目:keystone4j    文件:BoneCPConnectionProvider.java   
@SuppressWarnings("unchecked")
@Override
public <T> T unwrap(Class<T> unwrapType) {

    if (BoneCPConnectionProvider.class.equals(unwrapType) || BoneCPConnectionProvider.class.isAssignableFrom(unwrapType)) {
        return (T) this;
    } else {
        throw new UnknownUnwrapTypeException(unwrapType);
    }
}
项目:vibur-dbcp-hibernate4.012    文件:ViburDBCPConnectionProvider.java   
@Override
@SuppressWarnings( {"unchecked"})
public <T> T unwrap(Class<T> unwrapType) {
    if (isUnwrappableAs(unwrapType))
        return (T) this;
    else
        throw new UnknownUnwrapTypeException(unwrapType);
}
项目:vibur-dbcp-hibernate4    文件:ViburDBCPConnectionProvider.java   
@Override
@SuppressWarnings( {"unchecked"})
public <T> T unwrap(Class<T> unwrapType) {
    if (isUnwrappableAs(unwrapType))
        return (T) this;
    else
        throw new UnknownUnwrapTypeException(unwrapType);
}
项目:appengine-hibernate    文件:CloudSqlConnectionProvider.java   
@Override
@SuppressWarnings( {"unchecked"})
public <T> T unwrap(Class<T> unwrapType) {
    if ( ConnectionProvider.class.equals( unwrapType ) ||
            CloudSqlConnectionProvider.class.isAssignableFrom( unwrapType ) ) {
        return (T) this;
    }
    else {
        throw new UnknownUnwrapTypeException( unwrapType );
    }
}
项目:nway-jdbc    文件:JndiConnectionProvider.java   
@Override
@SuppressWarnings({ "unchecked" })
public <T> T unwrap(Class<T> unwrapType) {
    if (ConnectionProvider.class.equals(unwrapType)
            || DatasourceConnectionProviderImpl.class.isAssignableFrom(unwrapType)) {
        return (T) this;
    } else if (DataSource.class.isAssignableFrom(unwrapType)) {
        return (T) this.dataSource;
    } else {
        throw new UnknownUnwrapTypeException(unwrapType);
    }
}