Hi Balendra, Currently MetaModel does not support this type of subquery. It would however be a wonderful addition I think. So I did go ahead and write up a JIRA issue for your request [1].
I can also share some insights into how we can go about solving the issue... Methods for using queries as operands needs to first be added to the API - the main point would be to check FilterItem class, and to add methods with Query parameters on the WhereBuilder class (or maybe even on FilterBuilder, if we also want to support for HAVING ... let's maybe wait and see with that). Then we need two implementations of handling it: First the general purpose implementation in the MetaModel core. This will enable (functional, not necesarily optimal) support for more or less all the modules. And then I think we need something specifically for JDBC support since this should/could rather easily be pushed to the database's SQL engine. In the JDBC module we basically "just" need to reuse the existing query rewriter mechanism. Should be straight forward. If you (or someone else) find it an interesting task, I will happily help out on the sideline to push you in the right direction and all. Kasper [1] https://issues.apache.org/jira/browse/METAMODEL-48 2014-04-10 18:16 GMT+02:00 Balendra Singh <[email protected]>: > Created new thread for this discussion. > > > On 10 April 2014 21:45, Balendra Singh <[email protected]> wrote: > > > Hi, > > > > While using Metamodel, we encountered a scenario in which we have to > write > > a metamodel query to delete some records using the following *IN *clause > > sql - > > > > * delete from <table name> where id in > > (<subquery>)* > > > > and we used the following query - > > > > updateableDataContext.executeUpdate(new UpdateScript() { > > @Override > > public void run(UpdateCallback callback) { > > > > RowDeletionBuilder where = callback.deleteFrom(<table > > name>).where( > > new FilterItem(<some select item>, > > OperatorType.IN, new SelectItem(<some select item>, new > > FromItem(<subquery>)))); > > }}); > > > > So can we use IN clause with sub-query to delete records. > > > > > > > > Thanks, > > Balendra > > > > > > > > > > > > On 31 March 2014 00:30, Kasper Sørensen <[email protected] > >wrote: > > > >> OK, I added a JIRA issue on improving this (METAMODEL-45) > >> > >> > >> 2014-03-25 23:54 GMT+01:00 Tomasz Guziałek < > >> [email protected]>: > >> > >> > +1 > >> > > >> > I was not persistent enough to wait until the test timeouts, it took > too > >> > long in my case. > >> > > >> > Regards, > >> > Tomasz > >> > > >> > From: Kasper Sørensen<mailto:[email protected]> > >> > Sent: Tuesday, March 25, 2014 10:05 PM > >> > To: [email protected]<mailto: > >> > [email protected]> > >> > > >> > Hi guys, > >> > > >> > Just wanted to take a note the my build is now taking very long to > >> complete > >> > since the HBase module has unittests that always try to connect to a > >> > localhost server. We should definately do like we do in the case of > e.g. > >> > MongoDB, Salesforce etc. - have a optional properties file for > >> connection > >> > information, and in case it is not specified, skip the tests for that > >> > particular backend type. > >> > > >> > Kasper > >> > > >> > > > > > > >
