test.java
来自「一个用spring技术的航空票务系统」· Java 代码 · 共 32 行
JAVA
32 行
package test;
import java.util.Iterator;
import java.util.List;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.FileSystemXmlApplicationContext;
import org.springframework.orm.hibernate3.HibernateTemplate;
import bit.jeffy.orm.Flight;
import bit.jeffy.orm.Order;
public class Test {
public static void main(String argv[]){
String hql="from Order order";
ApplicationContext context = new FileSystemXmlApplicationContext("WEB-INF/beans.xml");
HibernateTemplate template = (HibernateTemplate)context.getBean("hibernateTemplate");
Order order = null;
List list = template.find(hql);
Iterator it = list.iterator();
while(it.hasNext()){
order = (Order)it.next();
Flight f = (Flight)order.getOrderitem().getFlight();
System.out.print(order.getId()+",");
System.out.print(f.getPrice());
System.out.println("");
}
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?