我现在的问题是!公司和公司行业是多对多的关系。在做关系映射时分成了两个一对多的关系,所以就有了中间表。 公司行业
public class Industry implements java.io.Serializable {
private Integer industryId;
/**行业与公司的中间映射表*/
private Set<CompanyIndustryRef> companyIndustryRefs = new HashSet<CompanyIndustryRef>(0); 公司行业中间表
public class CompanyIndustryRef implements java.io.Serializable {
private Integer companyIndustryRefId;
private Company company;
private Industry industry; 公司实体
public class Company implements java.io.Serializable {
private Integer companyId;
/**公司行业中间表*/
private Set<CompanyIndustryRef> companyIndustryRefs = new HashSet<CompanyIndustryRef>(0);
现在我在页面保存一个公司时,同时需要保存公司行业,在action中可以得到一组
List<Industry> listIndustry = new ArrayList<Industry>();//公司行业
公司行业,但是公司需要的是中间的companyIndustryRefs ,怎么转换!
public class Industry implements java.io.Serializable {
private Integer industryId;
/**行业与公司的中间映射表*/
private Set<CompanyIndustryRef> companyIndustryRefs = new HashSet<CompanyIndustryRef>(0); 公司行业中间表
public class CompanyIndustryRef implements java.io.Serializable {
private Integer companyIndustryRefId;
private Company company;
private Industry industry; 公司实体
public class Company implements java.io.Serializable {
private Integer companyId;
/**公司行业中间表*/
private Set<CompanyIndustryRef> companyIndustryRefs = new HashSet<CompanyIndustryRef>(0);
现在我在页面保存一个公司时,同时需要保存公司行业,在action中可以得到一组
List<Industry> listIndustry = new ArrayList<Industry>();//公司行业
公司行业,但是公司需要的是中间的companyIndustryRefs ,怎么转换!
解决方案 »
- 【求助】mysql转成oracle:无法转换为内部表示
- 急~~~~~~~~~~~图片为什么显示的很少,刷新一次才变大?
- 在数据库中用户有个在线状态,登陆和登出要改变该状态,可是当session销毁时如何改变该状态呢
- 赶着5.1到来之际,问小问题一个,希望大家进来看看
- 请问关于数据库事务的问题
- jspSmartUpload上传文件出问题,不是路径,但是什么问题我不知道???求救啊!!!!!!
- ◆◆伤心透了◆◆哪里有emf-sdo-runtime-2.0.0.zip非官方的网站下载,官方的网站下载得一天都没有下载下来
- 在 http://127.0.0.1:8080/ ... 下 打开jsp文件的问题
- 得分套餐(31分):7。jsp及servlet如何与JAVA application通讯,传递参数!!(分必给)
- 求助下,网页端js保存的session,java后台可以读取出来吗?
- sturuts2 json 问题
- 项目中异常的处理
给中间表的两个属性:company和industry赋值
Company com= new Company();
com.set()..
Industry ind= new Industry ();
ind.set()..
companyIndustryRef.setCompany(com);
companyIndustryRef.setIndustry(ind);
再用save(companyIndustryRef) ;
给中间表的两个属性:company和industry赋值
Company com= new Company();
com.set()..
Industry ind= new Industry ();
ind.set()..
companyIndustryRef.setCompany(com);
companyIndustryRef.setIndustry(ind);
再用save(companyIndustryRef) ;