日期:2014-05-17 浏览次数:21145 次
public class SelectCourse implements java.io.Serializable {
// Fields
private String snu;
private TearcherInfo tearcherInfo;
private StudentInfo studentInfo;
private CouresInfo couresInfo;
private String ctime;
private Integer cgrade;
/*get、set方法省略*/
public String addSelectCourse() throws Exception {
TearcherInfo tearcherInfo = new TearcherInfo();
StudentInfo studentInfo = new StudentInfo();
CouresInfo couresInfo = new CouresInfo();
System.out.println("学号:" + getSelectSnu() + "教师编号:"
+ getSelectTearcher() + "课程编号:" + getSelect1Course());
tearcherInfo.setTnu(getSelectTearcher());
studentInfo.setSnu(getSelectSnu());
couresInfo.setCnu(getSelect1Course());
selectCourse.setStudentInfo(studentInfo);//从此处开始出错!java.lang.NullPointerException
selectCourse.setCouresInfo(couresInfo);
selectCourse.setTearcherInfo(tearcherInfo);
selectCourse.setCgrade(getCgrade());
selectCourse.setCtime(getCtime());
try {
adm.saveSelectCourse(selectCourse);
} catch (Exception e) {
return "input";
}
return "success";
}
<hibernate-mapping>
<class name="com.yaxing.domain.SelectCourse" table="SelectCourse" schema="dbo" catalog="Student">
<id name="snu" type="java.lang.String">
<column name="Snu" length="16" />
<generator class="assigned" />
</id>
<many-to-one name="tearcherInfo" class="com.yaxing.domain.TearcherInfo" fetch="select">
<column name="Tnu" length="10" not-null="true" />
</many-to-one>
<many-to-one name="studentInfo" class="com.yaxing.domain.StudentInfo" update="false" insert="false" fetch="select">
<column name="Snu" length="16" not-null="true" unique="true" />
</many-to-one>
<many-to-one name="couresInfo" class="com.yaxing.domain.CouresInfo" fetch="select">
<column name="Cnu" length="10" not-null="true" />
</many-to-one>
<property name="ctime" type="java.lang.String">
<column name="Ctime" length="10" />
</property>
<property name="cgrade" type="java.lang.Integer">
<column name="Cgrade" />
</property>
</class>
</hibernate-mapping>
推荐阅读更多>
-
<s:iterator>使用request输出不已
-
日期格式化有关问题——初学者来挑战,老鸟别进来
-
Caused by: org.springframework.orm.hibernate3.HibernateQueryException:
-
session碰到麻烦了,往解答!
-
给意见的加到100分 进度条有关问题
-
J的结果为啥是0
-
关于承袭的一道试题苦逼无分求解答啊
-
有两道超难的机试题,哪位大哥能帮小弟我看下
-
一个js有关问题 跳出js的for循环
-
单例,多例。各有什么优缺点?该怎么处理
-
SSH2 事务代理有关问题
-
META-INF目录下的MANIFEST.MF是做什么用的?该如何处理
-
jsp 中文参数乱码
-
请教一下他说的对吗
-
劳驾高手啊
-
ssh2怎样用struts2的iterator后获得property的值再传到action的实例中去?解决办法
-
velocity怎么对日期进行格式化
-
求高手帮忙 小弟我是一个菜鸟
-
获得数据库时间.
-
来谈谈对CRM的了解 !(急)