日期:2014-05-17 浏览次数:21220 次
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下令什么意思:java -jar -Xms2048m -Xmx2048m OtaUpdateServer.jar ~/OTA/
-
java程序独自运行正确,用jsp调用就出错
-
java 多个数组排序有关问题!过完节的都进来看看!
-
使用java mail发送邮件报告的异常,请一二
-
hibernate 事务如何管理
-
请问J2EE中关于搜索结果的有关问题
-
请教,md5如何用,举个简单例子吧
-
请大家帮忙看一下.系统老提示小弟我address不能解析.小弟我真不知道错在哪里了.
-
跪求那位大哥能帮小弟做个《学生管理信息系统》,感激不尽,该如何解决
-
现在上载的JDK中都不含java的source code
-
SSH事物配置,该怎么解决
-
程序1執行到<%@ include file=""%>就有問題,奇怪!
-
目前什么语言的UI做得最好解决思路
-
顺序表读程序的简单有关问题
-
这到底是什么有关问题啊奇怪?
-
困扰了1晚上,早上还是找不出原因,求支援
-
至于将添加的数据进行除法运算
-
jsp 有没有像asp response.end的效能
-
初学hibernate,Hibernate Synchronizer这个插件感觉有点有关问题,死了!老是有错误
-
apache+resin与iis+tomcat解决方法