日期:2014-05-17 浏览次数:20983 次
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>
推荐阅读更多>
-
每个页面都有相同内容,怎么办更简便
-
jms topic模式下怎样才能责任书消息到达consumer
-
jsp中的session与struts的Action中的session不一致解决思路
-
tomcat启动之后读取mybatis-config.xml的时候延迟到45秒,该如何解决
-
jdbc 访问数据库 statement对象定义失误
-
jboss7在哪儿配置maxPostSize参数
-
怎么调用DLL到本地来操作串口
-
请问springMvc的controller如何避免json对象数组
-
java新手有四问,该如何处理
-
.PageNext{page-break-after: always;} 控制html打印分页有关问题
-
myeclipse的部署时出的有关问题
-
有没有人用过apache POI操作过 excel解决思路
-
webservice远程调用,该怎么解决
-
kubernetes idea 插件便捷操作
-
s:iterator 里的s:select 下拉框没有显示全部
-
Java中 有没有类似于 Js中的 Interval 的方法,或者setTimeout,该怎么处理
-
<c:set>标签设置javabean属性时出现的有关问题
-
如何实现获取msn好友信息?
-
jsp中怎么向SQL Server数据库中存储和读取word文件
-
新版论坛使用之体会,该怎么处理