如何使用Jersey API或任何其他jax-rs API在jax-rs中使用@HEAD?请给我样品.
在下面的代码方法doService1()更新正确的SQL但doService2()sql有一些问题,但是当我调用doService()它必须提交doService1()更新到DB,即使doService2()有一个sql exception因为doService2() 有一个REQUIRES_NEW Propagation类型,但当我doService1()没有这个更新不提交数据库..
@Service public class DbClass {
static Logger log = Logger.getLogger(
DbClass.class.getName());
@Autowired
private DataSource dataSource;
@Transactional(propagation=Propagation.REQUIRED)
public void doService(){
doService1();
doService2();
}
@Transactional(propagation=Propagation.REQUIRED)
public void doService1(){
JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource);
String sql = " update BATCHJOBSTATUS set PROCESSINGDATE = '20130322' " ;
int rowCount1 = jdbcTemplate.update(sql);
System.out.println(" rowCount1 >" + rowCount1);
}
@Transactional(propagation=Propagation.REQUIRES_NEW)
public void doService2(){
JdbcTemplate jdbcTemplate …Run Code Online (Sandbox Code Playgroud) 我在MyBatis中尝试了以下if子句,但出现以下异常,请在这里帮助我确定问题。
public class Student{
private Integer studId;
private String name;
private String email;
private Date dob;
}
Run Code Online (Sandbox Code Playgroud)
制图
<select id="searchStudent" parameterType="hashmap" resultMap="StudentResult">
<![CDATA[
SELECT * FROM STUDENTS
WHERE 1 = 1
<if test="studId != null">
AND STUD_ID= #{studId}
</if>
<if test="name != null">
AND NAME like #{name}
</if>
]]>
</select>
Run Code Online (Sandbox Code Playgroud)
我得到的异常:
Exception in thread "main" org.apache.ibatis.exceptions.PersistenceException:
### Error querying database. Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version …Run Code Online (Sandbox Code Playgroud)