Hi,
I'm developing a web application by IBatis framework to manage database. I
have a problem about insert and retrieve Timestamp value.
I use Mysql 5.0 for database and I create a table USER with TIMESTAMP type
for the DATE_OF_BIRD element. I create Java Bean User with dateOfBird member
by java.sql.Timestamp.
When I try to insert a new User by the IBatis insert() method the value in
the database is always 0000-00-00 00:00, but I would it's different value.
When I try a retrieve by queryForObject() method, the value for dateOfBird
in UserBean is null.
Below my user.xml:
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE sqlMap
PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0//EN"
"http://ibatis.apache.org/dtd/sql-map-2.dtd">
<sqlMap namespace="User">
<!-- Select with no parameters using the result map for Account class. -->
<select id="selectUser" resultClass="User">
SELECT U.ID_UTENTE as idUtente,
U.USERID as userId,
U.PASSWORD as password,
U.COGNOME as cognome,
U.NOME as nome,
U.DATE_OF_BIRD as dateOfBird,
U.PRIMA_PASSWORD as firstPassword,
U.ID_PROFILO as idProfile,
U.EMAIL as email,
U.USER_ACTIVE as userActive
FROM USER U
WHERE ID_UTENTE = #value#
</select>
<update id="insertUser" parameterClass="User">
INSERT INTO USER (USERID, PASSWORD, COGNOME, NOME, DATE_OF_BIRD,
PRIMA_PASSWORD, ID_PROFILO, EMAIL, USER_ACTIVE)
VALUES (#userId#, #password#, #cognome#, #nome#, #dateOfBird#,
#firstPassword#, #idProfile#, #email#, 'Y');
</update>
</sqlMap>
Someone can I help me?
Thank you.
--
View this message in context:
http://www.nabble.com/Problem-Timestamp-insert-and-retriev-tp16089864p16089864.html
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.