ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Klaene <mkla...@yahoo.com>
Subject OnJava article
Date Thu, 03 Feb 2005 13:21:56 GMT

Overall, I think it's a really good article. But one question about this example...

public void contactInsert() throws SQLException, IOException {
sqlMap.startTransaction();
try {
sqlMap.startTransaction();
Contact contact = new Contact();
contact.setContactId(3);
contact.setFirstName("John");
contact.setLastName("Doe");
sqlMap.insert("insertContact",contact);
sqlMap.commitTransaction();
} finally{
sqlMap.endTransaction();
}
}

Inside of our Java code, we create a Contact object, populate its values, and then call sqlMap.insert(),
passing the name of the query that we want to execute and the Contact. This method will insert
the new contact and return the primary key of the newly inserted contact.

Is that last sentence true? I am using <selectKey> now. 

Mike


		
---------------------------------
Do you Yahoo!?
 Yahoo! Search presents - Jib Jab's 'Second Term'
Mime
View raw message