Package com.ibatis.sqlmap

Source Code of com.ibatis.sqlmap.DirectFieldMappingTest

package com.ibatis.sqlmap;

import com.testdomain.FieldAccount;
import com.testdomain.PrivateAccount;

import java.sql.SQLException;

public class DirectFieldMappingTest extends BaseSqlMapTest {

  protected void setUp() throws Exception {
    initSqlMap("com/ibatis/sqlmap/maps/SqlMapConfig.xml", null);
    initScript("com/scripts/account-init.sql");
  }

  public void testInsertAndSelectDirectToFields() throws SQLException {
    FieldAccount account = newFieldAccount6();

    sqlMap.insert("insertAccountFromFields", account);

    account = (FieldAccount) sqlMap.queryForObject("getAccountToFields", new Integer(6));

    assertFieldAccount6(account);
    assertFieldAccount6(account.account());
  }

  public void testGetAccountWithPrivateConstructor() throws SQLException {
    FieldAccount account = newFieldAccount6();

    sqlMap.insert("insertAccountFromFields", account);

    PrivateAccount pvt = (PrivateAccount) sqlMap.queryForObject("getAccountWithPrivateConstructor", new Integer(6));

    assertPrivateAccount6(pvt);
  }


}
TOP

Related Classes of com.ibatis.sqlmap.DirectFieldMappingTest

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.