New to iBatis. I want to select two colums from TABLE_1 (e.g., COL_A and COL_B) and two columns from TABLE_2 (e.g, COL_C and COL_D). These 4 columns (selected from two separate tables) are attributes in MyObj.java (e.g attributeA, attributeB, attributeC and attributeD) respectively.
My questions: 1. Can I avoid writing lengthy resultMap entries and still accomplish the above? I know that I can accomplish selection from a single table by not writing resultMap entries. 2. If the answer to the above question is yes, I would like to verify; if this magic is possible because of me specifing the attribute name of the Java object beside the column name as: T1.COL_A as attributeA, T1.COL_B as attributeB, 3. If I did not have entry for resultMap and did not specify matching column with matching attribute (as shown in point 2 above), was there any way for iBatis to map database column to object attribute? If yes, is the requirement is to have the same name of the column as to the name of the attribute? This is just another question to better understand. It may not be advisable, nor practical to have same name for the database column and attribute name for the Java object. 4. Can I use code similar to the one below and get the result in MyObj.java, where MyObj.java has 4 attributes namely attributeA, attributeB, attributeC, attributeD matching COL_A and COL_B from TABLE_1 and COL_C and COL_D from TABLE_2 respectively. <select id="myQuery" parameterClass="int" resultClass="MyObj" > select T1.COL_A as attributeA, T1.COL_B as attributeB, T2.COL_C as attributeC, T2.COL_D as attributeD from TABLE_1 as T1 join TABLE_2 as T2 on T1.COL_A= T2.COL_C </select> -- View this message in context: http://www.nabble.com/Avoid-resultMap-for-Selecting-multiple-columns-from-multiple-tables-tp18927904p18927904.html Sent from the iBATIS - User - Java mailing list archive at Nabble.com.