摘要: 继承映射就是有一个基类和几个继承类共用一表作为映射。配置写在一个hbm.xml文件中。配置方法:1. 基类的2. 在基类的配置内,加上 分别类型不同的字段名3. 加上来表示子类的区分 阅读全文
posted @ 2013-11-10 23:18 holycrap 阅读(279) 评论(0) 推荐(0) 编辑
摘要: 1. 多对一的配置 配在"多"表中即可。parent 是类中的属性名, column="pid"是 对应表中的存储列注意,数据库中需要在“多”表中加上外键,关联“一”表。 "多"表中也得有一列来存储“一”表的一列。“一”表的那列需要是key在mysql中。alter table onetablexxx add constraint xxxx foreign key (xxx) reference manyTbale(key);2. 一对多的配置一的类中加上Set=new HashSet();或者List之类的集合hbm.xml中配上。 阅读全文
posted @ 2013-11-10 23:12 holycrap 阅读(268) 评论(0) 推荐(0) 编辑
摘要: 这样在类中@Service("xxx")写在service类的类定义上面,注入dao的地方@Resourceprivate IxxxDao xxdao在IxxxDao接口实现的类定义上方,写上@Repository("xxdao")xxxDaoImpl implements IXXXDao 阅读全文
posted @ 2013-11-10 23:00 holycrap 阅读(2639) 评论(0) 推荐(0) 编辑
摘要: 1. 写一个基础的接口和类来做基本的操作/** * */package com.wolfgang.dao;import java.util.List;/** * @author Administrator * */public interface IBaseDao { public void save(Object obj); public void update(Object obj); public void delete(Object obj); public T findById(Class className, int id); public Li... 阅读全文
posted @ 2013-11-10 22:55 holycrap 阅读(215) 评论(0) 推荐(0) 编辑
摘要: mysqlalter table xxx drop foreign key xxx cascade;oraclealter table drop constraint xxxxx cascade; 阅读全文
posted @ 2013-11-10 10:36 holycrap 阅读(215) 评论(0) 推荐(0) 编辑