Hi Jeff,
Thanks for this. It has worked.
I have one more question. In my table, the primary key is to be generated using a sequence (I am using Oracle). Now, I have altered the Insert in the sql map file so that it does not take the ID from the parameter Class. I need the value of the sequence that gets generated for the newly inserted record so that I can use it to populate other related tables. Can you suggest a good method of doing this using iBATIS?
Thanks so much
Regards
~Rashmi
From: Jeff Butler [mailto: [EMAIL PROTECTED]]
Sent: Monday, February 06, 2006 7:44 PM
To: [email protected]
Subject: Re: [Abator] selectByExample not working?
Add this line of code before calling the DAO method:
roleExl.setIsActive_Indicator(RolesExample.EXAMPLE_EQUALS);
HTH -
Jeff Butler
On 2/5/06, Rashmi Dave < [EMAIL PROTECTED]> wrote:
Hi Jeff,
I am using Abator generated DAO classes to fire queries against the tables.
I would like to select those rows in a table where the ACTIVE column is "Y".
For this my code reads
RolesExample roleExl = new RolesExample();
roleExl.setIsActive("Y");
List roleGrps = roleDAO.selectByExample(roleExl);
I would like this to generate a WHERE ACTIVE = 'Y' in the select query.
However, I find that the list being returned has all the rows in the table.
Not sure if I am using this right. Can you please help?
Thanks in advance
Cheers!
Rashmi
iBATIS and Abator support sequences directly - there's no need to alter the generated inserts if you configure the abator_config file properly. To use, specify something like this in your Abator configuration:
<table schema="someschema" tableName="someTable">
<generatedKey column="some_column" sqlStatement="select sequence.nextval from someSequence"
identity="false"/>
</table>
You'll need to replace all the values in the above example to the actual values in your database.
When you run the DAO insert method, it will return the newly generated key - so you can use the value in other queries.
Jeff Butler
On 2/6/06, Rashmi Dave <[EMAIL PROTECTED]> wrote:
- Re: [Abator] selectByExample not working? Jeff Butler
- RE: [Abator] selectByExample not working? Rashmi Dave
- Re: [Abator] selectByExample not working? Jeff Butler
