Package org.beangle.model.persist.hibernate

Source Code of org.beangle.model.persist.hibernate.HibernateEntityDaoTest

/* Copyright c 2005-2012.
* Licensed under GNU  LESSER General Public License, Version 3.
* http://www.gnu.org/licenses
*/
package org.beangle.model.persist.hibernate;

import org.beangle.model.example.Employer;
import org.beangle.model.persist.EntityDao;
import org.testng.annotations.Test;

@Test
public class HibernateEntityDaoTest extends ConfigurationTest {

  /**
   * Test Hql with parameters array;
   */
  public void testQueryHqlWithParamArray() {
    EntityDao entityDao = (EntityDao) applicationContext.getBean("entityDao");
    //List<?> tables=entityDao.search(new SqlQuery("SELECT table_name FROM INFORMATION_SCHEMA.TABLES"));
    entityDao.searchHQLQuery("from "+Employer.class.getName()+" where name.firstName=? and contractInfo.add1=?",
        new Object[] { "john", "najing street" });
  }

  /**
   * Test bulk update
   */
  public void testUpdate() {
    EntityDao entityDao = (EntityDao) applicationContext.getBean("entityDao");
    entityDao.update(Employer.class, "id", new Long[] { 1L }, new String[] { "name.firstName" },
        new Object[] { "me" });
  }
}
TOP

Related Classes of org.beangle.model.persist.hibernate.HibernateEntityDaoTest

TOP
Copyright © 2018 www.massapi.com. 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.