多对一,多对对的配置文件

多对一:

多方配置:


	
		
			
		
		 //column如果与数据库一致可以省略
		
		
		
	

一方配置:

	
		
			
		
		
		
		
			
			
		
	
  


类中有set集合,在hbm中就要配置set集合
类中没有set集合,在hbm中就直接配置关系

注意:两个配置文件的外键必须对应!!!!!

  <mapping resource="cn/itcast/a_oneToMany/Customer.hbm.xml"/>

  < mapping resource = "cn/itcast/a_oneToMany/Order.hbm.xml" />  

多对多:

假设student与course多对多。

student的hbm配置:


	
		
			
		
		
		
		
			
			
		
	



course的hbm文件配置:


	
		
			
		
		
		
		
			
			
		
	


 



你可能感兴趣的:(多对一,多对对的配置文件)