日期:2014-05-17 浏览次数:20803 次
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>
推荐阅读更多>
-
软件开发,是不是都是没加班费的啊该如何解决
-
java中常用类String类有关问题
-
java 当父类对象变量引述子类对象
-
Collections.sort排序的有关问题,请问
-
数据库表里字段如何也更新不了
-
sql中datatime和JDBC的时间类型的有关问题
-
哪位高手有UltraEdit32的13.00+4版本的破解版或者激活码,偶现在的测试版已经快过期了,感激不尽,高分奖励
-
APS改写替JSP
-
百度编辑器UEditor 在J2EE停使用
-
RequestDispatcher rd = request.getRequestDispatcher跳转页面出现有关问题
-
java poi 读取Excel文件,循环合并单元格,该如何处理
-
小弟我在读一段原码的时候,看到一个有关问题代码
-
:访问手机硬件的有关问题
-
关于java2word(jacob)的轮换
-
java访问Novell ldap NDS!请好手帮忙,在不解决要失业了
-
mysql数据如何才能导入到oralce里
-
神州数码思奇特成都分公司 面试等结果,该如何解决
-
B/S架构企业使用与网站开发的区别
-
本人使用struts技术,其中的struts-config.xml文件都是手工写的,到了myeclipse时怎么再让他生成图形文件呢
-
关于二进制浮点数在内存中的表示方式解决方法