Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
有一个值对象 processVO,其中包含字符串类型的日期变量(使用 getter 和 setter)。我试图通过以下方式将其填充到我的 DAO 类中:- PreparedStatement.setString(processVO.getDate); 它给了我一个错误:- 无法将日期类型转换为字符串。//存储在 processVO.getDate() 中的值具有日期和时间,即“2-apr-2013 1:20 am”
这不应该被认为是一个好的做法,但如果简单地检索字符串,您可以在 processVO.getDate() 上使用 toString() 方法,例如
processVO.getDate().toString()