Package org.hibernate.cfg

Examples of org.hibernate.cfg.JDBCMetaDataConfiguration


   
  public JDBCConfigurationTask() {
    setDescription("JDBC Configuration (for reverse engineering)");
  }
  protected Configuration createConfiguration() {
    return new JDBCMetaDataConfiguration();
  }
View Full Code Here


 
  /* (non-Javadoc)
   * @see org.hibernate.tool.hbm2x.ant.ConfigurationTask#doConfiguration(org.hibernate.cfg.Configuration)
   */
  protected void doConfiguration(Configuration configuration) {
    JDBCMetaDataConfiguration jmdc = (JDBCMetaDataConfiguration) configuration;
    super.doConfiguration(jmdc);
   
        jmdc.setPreferBasicCompositeIds(preferBasicCompositeIds);

    DefaultReverseEngineeringStrategy defaultStrategy = new DefaultReverseEngineeringStrategy();
   
    ReverseEngineeringStrategy strategy = defaultStrategy;
   
    if(revengFiles!=null) {
      OverrideRepository or = new OverrideRepository();
     
      String[] fileNames = revengFiles.list();
      for (int i = 0; i < fileNames.length; i++) {
        or.addFile(new File(fileNames[i]) );
      }
      strategy = or.getReverseEngineeringStrategy(defaultStrategy);     
    }
   
    if(reverseEngineeringStrategyClass!=null) {
      strategy = loadreverseEngineeringStrategy(reverseEngineeringStrategyClass, strategy);     
    }
   
    ReverseEngineeringSettings qqsettings =
      new ReverseEngineeringSettings(strategy).setDefaultPackageName(packageName)
      .setDetectManyToMany( detectManyToMany )
      .setDetectOneToOne( detectOneToOne )
      .setDetectOptimisticLock( detectOptimisticLock );
 
    defaultStrategy.setSettings(qqsettings);
    strategy.setSettings(qqsettings);
   
        jmdc.setReverseEngineeringStrategy(strategy);
       
    jmdc.readFromJDBC();
  }
View Full Code Here

         {
            if (!descriptor.getConnectionProperties().equals(currentConnectionProperties))
            {
               exception = null;
               currentConnectionProperties = descriptor.getConnectionProperties();
               jmdc = new JDBCMetaDataConfiguration();
               jmdc.setProperties(descriptor.getConnectionProperties());
               jmdc.setReverseEngineeringStrategy(createReverseEngineeringStrategy());
               try
               {
                  helper.buildMappings(descriptor.getUrls(), descriptor.getDriverClass(), jmdc);
View Full Code Here

         public Iterable<String> call() throws Exception
         {
            if (!descriptor.getConnectionProperties().equals(currentConnectionProperties))
            {
               currentConnectionProperties = descriptor.getConnectionProperties();
               jmdc = new JDBCMetaDataConfiguration();
               jmdc.setProperties(descriptor.getConnectionProperties());
               jmdc.setReverseEngineeringStrategy(createReverseEngineeringStrategy());
               helper.buildMappings(descriptor.getUrls(), descriptor.getDriverClass(), jmdc);
               Iterator<Object> iterator = jmdc.getTableMappings();
               tables = new ArrayList<>();
View Full Code Here

            if (!descriptor.getConnectionProperties().equals(currentConnectionProperties))
            {
               tables = new ArrayList<>();
               exception = null;
               currentConnectionProperties = descriptor.getConnectionProperties();
               jmdc = new JDBCMetaDataConfiguration();
               jmdc.setProperties(descriptor.getConnectionProperties());
               jmdc.setReverseEngineeringStrategy(createReverseEngineeringStrategy());
               try
               {
                  helper.buildMappings(descriptor.getUrls(), descriptor.getDriverClass(), jmdc);
View Full Code Here

         public Iterable<String> call() throws Exception
         {
            if (!descriptor.getConnectionProperties().equals(currentConnectionProperties))
            {
               currentConnectionProperties = descriptor.getConnectionProperties();
               jmdc = new JDBCMetaDataConfiguration();
               jmdc.setProperties(descriptor.getConnectionProperties());
               jmdc.setReverseEngineeringStrategy(createReverseEngineeringStrategy());
               helper.buildMappings(descriptor.getUrls(), descriptor.getDriverClass(), jmdc);
               Iterator<Table> iterator = jmdc.getTableMappings();
               tables = new ArrayList<>();
View Full Code Here

  private static final String TABLE2 = "cat.master";
  private static final String QTABLE2 = quote(TABLE2);
 
  public void testReadOnlySpecificSchema() {
   
    JDBCMetaDataConfiguration configuration = new JDBCMetaDataConfiguration();
   
    OverrideRepository or = new OverrideRepository();
    or.addSchemaSelection(new SchemaSelection(null, SCHEMA));
    configuration.setReverseEngineeringStrategy(or.getReverseEngineeringStrategy(new DefaultReverseEngineeringStrategy()));
    configuration.readFromJDBC();
   
    List tables = getTables(configuration);
   
    assertEquals(2,tables.size());
   
View Full Code Here

            catch (SQLException se) {
                System.err.println("Error while dropping - normally ok.");
                se.printStackTrace();
            }   
       
    cfg = new JDBCMetaDataConfiguration();   
    configure(cfg);
   
    String[] sqls = getCreateSQL();
   
        executeDDL(sqls, false);
View Full Code Here

  }
 
  protected void setUp() throws Exception {
    super.setUp();
   
    localCfg = new JDBCMetaDataConfiguration();
       
        DefaultReverseEngineeringStrategy c = new DefaultReverseEngineeringStrategy();
        c.setSettings(new ReverseEngineeringSettings(c).setDetectManyToMany(false));       
        localCfg.setReverseEngineeringStrategy(c);
        localCfg.readFromJDBC();
View Full Code Here

    super.configure( configuration );
  }
 
  public void testReadOnlySpecificSchema() {
   
    JDBCMetaDataConfiguration configuration = new JDBCMetaDataConfiguration();
   
    OverrideRepository or = new OverrideRepository();
    or.addSchemaSelection(new SchemaSelection(null, "OVRTEST"));
    configuration.setReverseEngineeringStrategy(or.getReverseEngineeringStrategy(new DefaultReverseEngineeringStrategy()));
    configuration.readFromJDBC();
   
    List tables = getTables(configuration);
   
    assertEquals(2,tables.size());
   
View Full Code Here

TOP

Related Classes of org.hibernate.cfg.JDBCMetaDataConfiguration

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.