Package org.hibernate.tool.hbm2x

Examples of org.hibernate.tool.hbm2x.POJOExporter


  public void setJdk5(boolean b) {
    jdk5 = b;
  }

  protected Exporter configureExporter(Exporter exp) {
    POJOExporter exporter = (POJOExporter) exp;
    super.configureExporter( exp );
        exporter.getProperties().setProperty("ejb3", ""+ejb3);
        exporter.getProperties().setProperty("jdk5", ""+jdk5);
    return exporter;
  }
View Full Code Here


        exporter.getProperties().setProperty("jdk5", ""+jdk5);
    return exporter;
  }

  protected Exporter createExporter() {
    return new POJOExporter();
  }
View Full Code Here

    protected Exporter configureExporter(Exporter exp) throws MojoExecutionException {
        // add output directory to compile roots
        getProject().addCompileSourceRoot(new File(getComponent().getOutputDirectory()).getPath());

        // now set the extra properties for the POJO Exporter
        POJOExporter exporter = (POJOExporter) super.configureExporter(exp);

        // Add custom template path if specified
        String[] templatePaths;
        if (templateDirectory != null) {
            templatePaths = new String[exporter.getTemplatePaths().length + 1];
            templatePaths[0] = templateDirectory;
            if (exporter.getTemplatePaths().length > 1) {
                for (int i = 1; i < exporter.getTemplatePaths().length; i++) {
                    templatePaths[i] = exporter.getTemplatePaths()[i-1];
                }
            }
        } else {
            templatePaths = exporter.getTemplatePaths();
        }

        exporter.setTemplatePath(templatePaths);
        exporter.setTemplateName("appfuse/model/Pojo.ftl");
        exporter.getProperties().setProperty("basepackage", getProject().getGroupId());
        exporter.getProperties().setProperty("ejb3", getComponentProperty("ejb3", "true"));
        exporter.getProperties().setProperty("jdk5", getComponentProperty("jdk5", "true"));

        if (isFullSource()) {
            exporter.getProperties().setProperty("appfusepackage", getProject().getGroupId());
        } else {
            exporter.getProperties().setProperty("appfusepackage", "org.appfuse");
        }

       
        return exporter;
    }
View Full Code Here

     * Instantiates a org.hibernate.tool.hbm2x.POJOExporter object.
     *
     * @return POJOExporter
     */
    protected Exporter createExporter() {
        return new POJOExporter();
    }
View Full Code Here

   private Collection<String> exportSelectedEntities()
   {
      final Collection<String> selectedTableNames = Lists.toList(databaseTables.getValue());
      JavaSourceFacet java = descriptor.getSelectedProject().getFacet(JavaSourceFacet.class);
      POJOExporter pj = new POJOExporter(jmdc, java.getSourceDirectory().getUnderlyingResourceObject())
      {
         @Override
         @SuppressWarnings("rawtypes")
         protected void exportPOJO(Map additionalContext, POJOClass element)
         {
            if (isSelected(selectedTableNames, element))
            {
               super.exportPOJO(additionalContext, element);
            }
         }
      };
      Properties pojoProperties = new Properties();
      pojoProperties.setProperty("jdk5", "true");
      pojoProperties.setProperty("ejb3", "true");
      pj.setProperties(pojoProperties);
      pj.setArtifactCollector(new ArtifactCollector());
      pj.start();
      return selectedTableNames;
   }
View Full Code Here

   private Collection<String> exportSelectedEntities()
   {
      final Collection<String> selectedTableNames = Lists.toList(databaseTables.getValue());
      JavaSourceFacet java = descriptor.getSelectedProject().getFacet(JavaSourceFacet.class);
      POJOExporter pj = new POJOExporter(jmdc, java.getSourceDirectory().getUnderlyingResourceObject())
      {
         @Override
         @SuppressWarnings("rawtypes")
         protected void exportPOJO(Map additionalContext, POJOClass element)
         {
            if (isSelected(selectedTableNames, element))
            {
               super.exportPOJO(additionalContext, element);
            }
         }
      };
      Properties pojoProperties = new Properties();
      pojoProperties.setProperty("jdk5", "true");
      pojoProperties.setProperty("ejb3", "true");
      pj.setProperties(pojoProperties);
      pj.setArtifactCollector(new ArtifactCollector());
      pj.start();
      return selectedTableNames;
   }
View Full Code Here

   private Collection<String> exportSelectedEntities()
   {
      final Collection<String> selectedTableNames = Lists.toList(databaseTables.getValue());
      JavaSourceFacet java = descriptor.getSelectedProject().getFacet(JavaSourceFacet.class);
      POJOExporter pj = new POJOExporter(jmdc, java.getSourceDirectory().getUnderlyingResourceObject())
      {
         @Override
         @SuppressWarnings("rawtypes")
         protected void exportPOJO(Map additionalContext, POJOClass element)
         {
            if (isSelected(selectedTableNames, element))
            {
               super.exportPOJO(additionalContext, element);
            }
         }
      };
      Properties pojoProperties = new Properties();
      pojoProperties.setProperty("jdk5", "true");
      pojoProperties.setProperty("ejb3", "true");
      pj.setProperties(pojoProperties);
      pj.setArtifactCollector(new ArtifactCollector());
      pj.start();
      return selectedTableNames;
   }
View Full Code Here

   private Collection<String> exportSelectedEntities()
   {
      final Collection<String> selectedTableNames = Lists.toList(databaseTables.getValue());
      JavaSourceFacet java = descriptor.getSelectedProject().getFacet(JavaSourceFacet.class);
      POJOExporter pj = new POJOExporter(jmdc, java.getSourceDirectory().getUnderlyingResourceObject())
      {
         @Override
         @SuppressWarnings("rawtypes")
         protected void exportPOJO(Map additionalContext, POJOClass element)
         {
            if (isSelected(selectedTableNames, element))
            {
               super.exportPOJO(additionalContext, element);
            }
         }
      };
      Properties pojoProperties = new Properties();
      pojoProperties.setProperty("jdk5", "true");
      pojoProperties.setProperty("ejb3", "true");
      pj.setProperties(pojoProperties);
      pj.setArtifactCollector(new ArtifactCollector());
      pj.start();
      return selectedTableNames;
   }
View Full Code Here

    HibernateMappingExporter hme = new HibernateMappingExporter(cfg, getOutputDir());
    hme.start();   

    getConfiguration().buildMappings();
    POJOExporter exporter = new POJOExporter(getConfiguration(), getOutputDir());
    Properties p = new Properties();
    p.setProperty("jdk5", "true");
    p.setProperty("ejb3", "true");

    exporter.setProperties(p);
    exporter.start();

    File file = new File( "ejb3compilable" );
    file.mkdir();

    ArrayList list = new ArrayList();
View Full Code Here

 
  public void testGenerateJPA() throws Exception{
       
        cfg.buildMappings()
       
    POJOExporter exporter = new POJOExporter(cfg, getOutputDir() );
    exporter.setTemplatePath(new String[0]);
    exporter.getProperties().setProperty("ejb3", "true");
    exporter.getProperties().setProperty("jdk5", "true");
    exporter.start();
   
    File file = new File( "ejb3compilable" );
    file.mkdir();
   
    ArrayList list = new ArrayList();
View Full Code Here

TOP

Related Classes of org.hibernate.tool.hbm2x.POJOExporter

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.