hibarnate对象的映射文件以下数据库
<id name="outlet" type="string">
<column name="OUTLET" length="10" />
<generator class="assigned" />
</id>
<!-- <property name="code" type="string">
<column name="CODE" length="10" />
</property> -->
<property name="code" type="string">
<column name="CODE" length="5" />
</property>
<property name="outline" type="string">
<column name="OUTLINE" length="5" />
</property>spa
在数据库中outlet、code、outline为联合组件。hibarnate插入可如此插入code
if(null!=outlet){
String[] outlets1 = outlet.split(",");
String cade=discHd.getCode();
for(int i=0;i<outlets1.length;i++){
System.out.println(i+":"+outlets1[i]);
DiscS discS=new DiscS();
discS.setOutlet(outlets1[i]);
discS.setCode(cade);//不变
discS.setOutline("6");
discS.setUpdatedBy("0000001");
discSService.save(discS);
}
}对象
由于映射文件中的id定义为outlet,而插入时是不相同的。因此能够插入!get