UniqueConstraintException and Mysql
UniqueConstraintException and Mysql
- Subject: UniqueConstraintException and Mysql
- From: Theodore Petrosky <email@hidden>
- Date: Mon, 16 Jan 2017 23:15:06 -0500
I have this working fine with my postgresql backend. I created an index on the User entity. I have a Constraint Distinct on the login attribute. The index is named login_idx.
so in my ValidationTemplate.strings file I have:
{
"UniqueConstraintException.login_idx" = "Please choose a different login (It must be unique).";
}
This doesn’t seem to work with a MySQL backend or I am not remembering to wire something else in. After I ran the migrations, I see the index on the table and I see the errors in my console:
EvaluateExpression failed: <com.webobjects.jdbcadaptor._MySQLPlugIn$MySQLExpression: "INSERT INTO User(unreadcount, website, title, phone, active, story, created, keywords, ipaddress, adjusted, status, lastlogin, kind, id, role, language, timezone, type, password, email) VALUES (NULL, NULL, ?, NULL, ?, NULL, ?, NULL, NULL, ?, NULL, NULL, NULL, ?, NULL, NULL, NULL, NULL, ?, ?)" withBindings: 1:"User"(title), 2:true(active), 3:2017-01-17 04:09:40(created), 4:2017-01-17 04:09:40(adjusted), 5:7(id), 6:"SlCWtgVlm5W/+zMGkl9pKcA1MMg="(password), 7:"email@hidden"(email)>: Next exception:SQL State:23000 -- error code: 1062 -- msg: Duplicate entry 'email@hidden' for key ‘login_idx'
there it is:
error code: 1062 -- msg: Duplicate entry 'email@hidden' for key ‘login_idx'
so Mysql is complaining and i am not catching it correctly. Googling doesn’t seem to help here.
Ted
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden