Package com.jada.jpa.connection

Examples of com.jada.jpa.connection.JpaConnection


      System.out.println(writer.toString());
  }
 
  public void test() {
    try {
      JpaConnection connection = JpaConnection.getInstance();
      connection.init();
      EntityManager em = connection.getCurrentEntityManager();
      em.getTransaction().begin();
     
      SiteDomain siteDomain = SiteDomainDAO.load(Long.valueOf(5));
     
      Menu parent = MenuDAO.load("Electronics", Long.valueOf(11));
     
      for (Menu menu : parent.getMenuChildren()) {
        System.out.println(menu.getMenuId() + " " + menu.getMenuLanguage().getMenuName());
      }

          Menu menu = new Menu();
          menu.setSiteDomain(siteDomain);
          menu.setMenuParent(parent);
          menu.setSeqNum(10);
          menu.setMenuSetName("MAIN");
          menu.setMenuType(Constants.MENU_HOME);
          menu.setMenuUrl("");
          menu.setMenuWindowTarget("");
          menu.setMenuWindowMode("");
          menu.setPublished(Constants.PUBLISHED_YES);
          menu.setRecUpdateBy("admin");
          menu.setRecCreateBy("admin");
          menu.setRecUpdateDatetime(new Date(System.currentTimeMillis()));
          menu.setRecCreateDatetime(new Date(System.currentTimeMillis()));
         
          MenuLanguage menuLanguage = new MenuLanguage();
          menuLanguage.setMenuName("New Menu 6");
          menuLanguage.setMenu(menu);
          menuLanguage.setRecUpdateBy("admin");
          menuLanguage.setRecCreateBy("admin");
          menuLanguage.setRecUpdateDatetime(new Date(System.currentTimeMillis()));
          menuLanguage.setRecCreateDatetime(new Date(System.currentTimeMillis()));
          SiteProfileClass siteProfileClass = SiteProfileClassDAO.load(Long.valueOf(6));
          menuLanguage.setSiteProfileClass(siteProfileClass);
          em.persist(menuLanguage);
          menu.getMenuLanguages().add(menuLanguage);
          menu.setMenuLanguage(menuLanguage);
          em.persist(menu);
         
          em = connection.getCurrentEntityManager();         

          String sql = "from Menu menu where menu.menuParent.menuId = 11";
          Query query = em.createQuery(sql);
          Iterator<?> iterator = query.getResultList().iterator();
          while (iterator.hasNext()) {
View Full Code Here


    table.remove(siteId);
  }
 
  public void init() throws Exception {
    CompassConfiguration compassConfiguration = new CompassConfiguration();
    JpaConnection jpaConnection = JpaConnection.getInstance();
    if (ApplicationGlobal.isCompassDatabaseStore()) {
      compassConfiguration.setSetting(CompassEnvironment.CONNECTION, "jdbc://" + jpaConnection.getUrl());
      compassConfiguration.setSetting(LuceneEnvironment.JdbcStore.DataSourceProvider.CLASS, C3P0DataSourceProvider.class.getName());
      compassConfiguration.setSetting(LuceneEnvironment.JdbcStore.Connection.DRIVER_CLASS, jpaConnection.getDriver());
      compassConfiguration.setSetting(LuceneEnvironment.JdbcStore.Connection.USERNAME, jpaConnection.getUser());
      compassConfiguration.setSetting(LuceneEnvironment.JdbcStore.Connection.PASSWORD, jpaConnection.getPassword());
    }
    else {
      String directory = ApplicationGlobal.getWorkingDirectory();
      if (!directory.endsWith("/") && !directory.endsWith("\\")) {
        directory += "/";
View Full Code Here

TOP

Related Classes of com.jada.jpa.connection.JpaConnection

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.