Hi. Consider these two tables: Order and OrderItem. The relationship is one to many. To save an order, two SQL command should be executed: Insert a row in Order table (ORDER_ID is auto generated). Insert a row in OrderItem table (OI_ID is auto generated and the primary key of the previous insert is needed in this command). I'm trying to adopt iBatis and MySQL as the database. The problem is I don't know how to get the PK of the first row in order to be passed to the second row? Any ideas?