本文整理匯總了Java中org.apache.ibatis.submitted.typehandler.Product.ConstantProductIdTypeHandler類的典型用法代碼示例。如果您正苦於以下問題:Java ConstantProductIdTypeHandler類的具體用法?Java ConstantProductIdTypeHandler怎麽用?Java ConstantProductIdTypeHandler使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
ConstantProductIdTypeHandler類屬於org.apache.ibatis.submitted.typehandler.Product包,在下文中一共展示了ConstantProductIdTypeHandler類的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: shouldFailIfMultipleHandlerMappedToAType
import org.apache.ibatis.submitted.typehandler.Product.ConstantProductIdTypeHandler; //導入依賴的package包/類
@Test(expected = BuilderException.class)
public void shouldFailIfMultipleHandlerMappedToAType() throws Exception {
sqlSessionFactory.getConfiguration().getTypeHandlerRegistry().register(ProductId.class, JdbcType.BIGINT, ConstantProductIdTypeHandler.class);
// multiple type handlers are mapped to ProductId and
// none of them are mapped to null jdbcType.
addMapper();
}
示例2: shouldPickHandlerForNull
import org.apache.ibatis.submitted.typehandler.Product.ConstantProductIdTypeHandler; //導入依賴的package包/類
@Test
public void shouldPickHandlerForNull() throws Exception {
sqlSessionFactory.getConfiguration().getTypeHandlerRegistry().register(ProductId.class, null, ConstantProductIdTypeHandler.class);
// multiple type handlers are mapped to ProductId and
// one of them are mapped to null jdbcType.
addMapper();
SqlSession sqlSession = sqlSessionFactory.openSession();
try {
Mapper mapper = sqlSession.getMapper(Mapper.class);
Product product = mapper.getProductByNameXml("iPad");
assertEquals(Integer.valueOf(999), product.getId().getValue());
} finally {
sqlSession.close();
}
}