@Results({
@Result(column="SID" , property = "stuId" , id = true)})
@Select("select * from student where sid = #{sId}")
public Student queryStuById(String sId);
多对一映射:
@Results({
@Result(column = "SID", property = "stuId", id = true),
@Result(property = "grade", column = "GID",
one = @One(select = "cn.et.lesson03.anno.GradeMapper.queryGradeById")) })
@Select("select * from student where sid = #{sId}")
public Student queryStuById(@Param("sId") String sId);
one表示多对一映射,多个学生属于一个grade,指向的方法也是一个grade:
@Select("select * from grade where GID = #{0}")
public Grade queryGradeById(String gId);
一对多映射:
指向的方法返回值是个list,所以还要在映射声明中指定一下javaType。
@Results({
@Result(column = "GID", property = "stuList", javaType = ArrayList.class,
many = @Many(select = "cn.et.lesson03.anno.StudentMapper.queryStusByGId")) })
@Select("select * from grade where GID = #{0}")
public Grade queryGradeById(String gId);
一对多用many表示,因为查询结果是多条,指向方法:
@Results({
@Result(column = "SID" , property = "stuId")})
@Select("select * from student where GID = #{param1}")
public List queryStusByGId(String gId);
1. 创建一个maven项目
2. 创建com.CoberturaStart.java
package com;
public class CoberturaStart {
public void helloEveryone(){
System.out.println("=================================================
我并不知道出现这个问题的实际原理,只是通过其他朋友的博客,文章得知的一个解决方案,目前先记录一个解决方法,未来要是真了解以后,还会继续补全.
在mysql5中有一个safe update mode,这个模式让sql操作更加安全,据说要求有where条件,防止全表更新操作.如果必须要进行全表操作,我们可以执行
SET
public class DeleteSpecificChars {
/**
* Q 63 在字符串中删除特定的字符
* 输入两个字符串,从第一字符串中删除第二个字符串中所有的字符。
* 例如,输入”They are students.”和”aeiou”,则删除之后的第一个字符串变成”Thy r stdnts.”
*/
public static voi
File descriptors are represented by the C int type. Not using a special type is often considered odd, but is, historically, the Unix way. Each Linux process has a maximum number of files th