日期:2014-05-16 浏览次数:20416 次
@Entity(name = "ONE") public class OneBean extends BaseBo { private BigDecimal id; @Id @Column(name = "ID") public BigDecimal getId() { return id; } // ... }
public class OneBeanService implements IOneBeanService { private CrudDaoFactory crudDaoFactory; public void noException() throws Exception { CrudDao<OneBean> crudDao = crudDaoFactory.getCrudDao(OneBean.class); OneBean bean = this.createOneBean(new BigDecimal(100)); crudDao.insert(bean); } // ... }
<bean id="crudDaoFactory" class="cn.iwoo.frame.orm.CrudDaoFactory"> <property name="dbType" value="mysql"/> <property name="dataSource" ref="dataSource"/> </bean> <bean id="oneBeanService" class="cn.iwoo.frame.orm.service.impl.OneBeanService"> <property name="crudDaoFactory" ref="crudDaoFactory"/> </bean>
16:48:11,156 DEBUG CrudDao:36 - INSERT INTO ONE(NAME, ID, PASSWORD, SEX, BIRTH_DATE_TIME) VALUES ('xx', 200, 'psw', null, '2009-02-23 16:48:11.156') 16:48:11,171 DEBUG CrudDao:66 - SELECT NAME, ID, PASSWORD, SEX, BIRTH_DATE_TIME FROM ONE WHERE ID = 200 16:48:11,203 DEBUG CrudDao:124 - NAME,ID,PASSWORD,SEX,BIRTH_DATE_TIME 16:48:11,203 DEBUG CrudDao:128 - xx,200,psw,null,2009-02-23 16:48:11.156