Package org.hibernate.cfg.reveng.dialect

Examples of org.hibernate.cfg.reveng.dialect.MetaDataDialect


public class MetaDataDialectFactory {

  public MetaDataDialect createMetaDataDialect(Dialect dialect, Properties cfg) {
    String property = cfg.getProperty( "hibernatetool.metadatadialect" );
    MetaDataDialect mdd = fromClassName(property);
    if(mdd==null) {
      mdd = fromDialect(dialect);
    }
    if(mdd==null) {
      mdd = fromDialectName(dialect.getClass().getName());
View Full Code Here


public class MetaDataDialectFactory {

  public MetaDataDialect createMetaDataDialect(Dialect dialect, Properties cfg) {
    String property = cfg.getProperty( "hibernatetool.metadatadialect" );
    MetaDataDialect mdd = fromClassName(property);
    if(mdd==null) {
      mdd = fromDialect(dialect);
    }
    if(mdd==null) {
      mdd = fromDialectName(dialect.getClass().getName());
View Full Code Here

 
  public static JDBCReader newJDBCReader(Properties cfg, Settings settings,
      ReverseEngineeringStrategy revengStrategy) {

    MetaDataDialect mdd = newMetaDataDialect( settings.getDialect(), cfg );

    return newJDBCReader( settings, revengStrategy, mdd );
  }
View Full Code Here

public class MetaDataDialectFactory {

  public MetaDataDialect createMetaDataDialect(Dialect dialect, Properties cfg) {
    String property = cfg.getProperty( "hibernatetool.metadatadialect" );
    MetaDataDialect mdd = fromClassName(property);
    if(mdd==null) {
      mdd = fromDialect(dialect);
    }
    if(mdd==null) {
      mdd = fromDialectName(dialect.getClass().getName());
View Full Code Here

 
  public void testNeedQuote() {
    Settings buildSettings = cfg.buildSettings();
    ServiceRegistry serviceRegistry = cfg.getServiceRegistry();
       
    MetaDataDialect realMetaData = JDBCReaderFactory.newMetaDataDialect( serviceRegistry.getService(JdbcServices.class).getDialect(), cfg.getProperties() );
    assertTrue("The name must be quoted!", realMetaData.needQuote(SCHEMA));
    assertTrue("The name must be quoted!", realMetaData.needQuote(TABLE1));
    assertTrue("The name must be quoted!", realMetaData.needQuote(TABLE2));
  }
View Full Code Here

  public void testQuotedNamesAndDefaultDatabaseCollector() {
    StandardServiceRegistryBuilder builder = new StandardServiceRegistryBuilder();
    ServiceRegistry serviceRegistry = builder.build();
    Settings buildSettings = cfg.buildSettings(serviceRegistry);
       
    MetaDataDialect realMetaData = JDBCReaderFactory.newMetaDataDialect( serviceRegistry.getService(JdbcServices.class).getDialect(), cfg.getProperties() );
   
    JDBCReader reader = JDBCReaderFactory.newJDBCReader( buildSettings, new DefaultReverseEngineeringStrategy(), realMetaData, serviceRegistry );
   
    DatabaseCollector dc = new DefaultDatabaseCollector(reader.getMetaDataDialect());
    reader.readDatabaseSchema( dc, null, SCHEMA );
View Full Code Here

   
    StandardServiceRegistryBuilder builder = new StandardServiceRegistryBuilder();
    ServiceRegistry serviceRegistry = builder.build();
    Settings buildSettings = cfg.buildSettings(serviceRegistry);
       
    MetaDataDialect realMetaData = JDBCReaderFactory.newMetaDataDialect( serviceRegistry.getService(JdbcServices.class).getDialect(), cfg.getProperties() );
   
    MockedMetaDataDialect mock = new MockedMetaDataDialect(realMetaData);
    CachedMetaDataDialect dialect = new CachedMetaDataDialect(mock);
   
    JDBCReader reader = JDBCReaderFactory.newJDBCReader( buildSettings, new DefaultReverseEngineeringStrategy(), dialect, serviceRegistry );
View Full Code Here

    };
  }

  public void testExportedKeys() {
 
    MetaDataDialect dialect = new JDBCMetaDataDialect();
    StandardServiceRegistryBuilder builder = new StandardServiceRegistryBuilder();
    ServiceRegistry serviceRegistry = builder.build();
    JdbcServices jdbcServices = serviceRegistry.getService(JdbcServices.class);
    Settings settings = cfg.buildSettings(serviceRegistry);
   
    dialect.configure( ReverseEngineeringRuntimeInfo.createInstance(jdbcServices.getConnectionProvider(),
        jdbcServices.getSqlExceptionHelper().getSqlExceptionConverter(), new DefaultDatabaseCollector(dialect)));
   
    Iterator tables = dialect.getTables( settings.getDefaultCatalogName(), settings.getDefaultSchemaName(), identifier("tab_master") );
   
    boolean foundMaster = false;
    while(tables.hasNext()) {
      Map map = (Map) tables.next();
     
      String tableName = (String) map.get("TABLE_NAME");
      String schemaName = (String) map.get("TABLE_SCHEM");
          String catalogName = (String) map.get("TABLE_CAT");
         
          if(tableName.equals(identifier("tab_master"))) {
        foundMaster = true;
        Iterator exportedKeys = dialect.getExportedKeys( catalogName, schemaName, tableName );
        int cnt = 0;
        while ( exportedKeys.hasNext() ) {
          Map element = (Map) exportedKeys.next();
          cnt++;
        }
View Full Code Here

    assertTrue(foundMaster);
  }

  public void testDataType() {
   
    MetaDataDialect dialect = new JDBCMetaDataDialect();
    StandardServiceRegistryBuilder builder = new StandardServiceRegistryBuilder();
    ServiceRegistry serviceRegistry = builder.build();
    JdbcServices jdbcServices = serviceRegistry.getService(JdbcServices.class);
    Settings settings = cfg.buildSettings(serviceRegistry);
   
    dialect.configure( ReverseEngineeringRuntimeInfo.createInstance(jdbcServices.getConnectionProvider(),
        jdbcServices.getSqlExceptionHelper().getSqlExceptionConverter(), new DefaultDatabaseCollector(dialect)));
   
    Iterator tables = dialect.getColumns( settings.getDefaultCatalogName(), settings.getDefaultSchemaName(), "test", null );
   
   
    while(tables.hasNext()) {
      Map map = (Map) tables.next();
     
View Full Code Here

  }
 
  public void testCaseTest() {
   
 
    MetaDataDialect dialect = new JDBCMetaDataDialect();
    StandardServiceRegistryBuilder builder = new StandardServiceRegistryBuilder();
    ServiceRegistry serviceRegistry = builder.build();
    JdbcServices jdbcServices = serviceRegistry.getService(JdbcServices.class);
    Settings settings = cfg.buildSettings(serviceRegistry);
   
    dialect.configure( ReverseEngineeringRuntimeInfo.createInstance(jdbcServices.getConnectionProvider(),
        jdbcServices.getSqlExceptionHelper().getSqlExceptionConverter(), new DefaultDatabaseCollector(dialect)));
   
    Iterator tables = dialect.getTables( settings.getDefaultCatalogName(), settings.getDefaultSchemaName(), identifier( "TAB_MASTER"));
   
    assertHasNext( 1,  tables );
   
   
   
View Full Code Here

TOP

Related Classes of org.hibernate.cfg.reveng.dialect.MetaDataDialect

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.