Duplicate an SQL Record

When working with SQL databases there are times you want to clone database rows and for whatever reason don't want to write out a ton of INSERT statements.  This would be easily handled by

insert into users select * from user where username="webuser1";

except that this will not handle unique key contraints, i.e. when your ssn or user_id fields must remain unique.  One convenient way to get around the restrictions on unique keys it to create a temporary table, clone the record, change necessary fields, then copy is back to the original table.
CREATE TEMPORARY TABLE users2 ENGINE=MEMORY SELECT * FROM users 
WHERE username="webuser1";
UPDATE users2 SET username=webuser2; ## Change the username to be unique
## Update any other fields that must be unique
INSERT INTO users SELECT * FROM users2;
DROP TABLE users2;

java.util.Date to java.sql.Date conversion error

For a database project (building a full retail store system) I've tried passing a java.util.Date to a Java prepared statement.  The problem is that the prepared statement expects java.sql.date, and converting it isn't working for me.  Here's the errant code: ps.setDate(2, emp.getDate()); which results in this error: no suitable constructor found for Date(java.util.Date) constructor java.sql.Date.Date(long) is not applicable (actual argument java.util.Date cannot be converted to long by method invocation conversion) constructor java.sql.Date.Date(int,int,int) is not applicable (actual and formal argument lists differ in length) The fix is to create an SQL Date using the java.util.Date as follows: java.sql.Date sqlDate = new java.sql.Date(emp.getDate().getTime()); Then, the prepared statement accepts the date. ps.setDate(2, sqlDate);