ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alin Popa <alin.p...@gmail.com>
Subject mysql default value
Date Tue, 17 Mar 2009 15:37:51 GMT
Hi,

I have the following db table (MySQL):

CREATE TABLE `examples`(
       `id` SERIAL PRIMARY KEY,
       `name` VARCHAR(255),
       `status` VARCHAR(20) NOT NULL DEFAULT 'ready',
       `description` TEXT
) ENGINE=innodb DEFAULT CHARSET utf8 DEFAULT COLLATE utf8_bin;


Using ibatis sql-map I'm doing this:

<insert id="insertExample" parameterClass="com.test.Example">
 INSERT INTO vjobs(name, status, description) VALUES
(#name#,#status#,#description#)
</insert>

When inserting an example object, without having "status" field set, I
got Column 'status' cannot be null; but the DEFAULT is 'ready'.

How can this be managed using ibatis ?
It is possible ?


Thanks.

Alin

Mime
View raw message