Problem is I don't know how many parameters I'll have. I can have 3 as I can have 4 or 5. The query can seem to : in (1,2,3) or in (2,4,15,78,99,76)...
--- In [email protected], "Cathy Reilly" <[EMAIL PROTECTED]> wrote: > > Here's an example when using Hibernate Named Queries. > > If I defined the following query in pet.hbm.xml, > <query name="owner.by.pet.name">select pet.owner from Pet as pet where > pet.name=?</query> > > Then my fill operation requires a single parameter to be supplied. This > is the value for the '?'. > > petDataService.fill(petCollection, "owner.by.pet.name", ["Buddy"]); > > > In you're case, the query also has a single parameter. In this case, > you should pass in a value for 'in (?)'. I'm not sure where the '*' > comes in. > > Perhaps the query should be <query name="taskProjects">select * From > Task where idProject in (?, ?, ?)</query> > In which case, the fill would be taskDataService.fill(tasksArray, > "tasksProjects", [1, 2, 3]); > > Which should resolve to 'select * From Task where idProject in (1, 2, > 3)' > that is > Query q2 = s.getNamedQuery("taskProjects"); > q2.setInt(0, 1); // where the first parameter is the position of the > ? and the second parameters it the value passed in > q2.setInt(1, 2); > q2.setInt(2, 3); > > - Cathy > > ________________________________ > > From: [email protected] [mailto:[EMAIL PROTECTED] On > Behalf Of jonathan_merey > Sent: Thursday, November 02, 2006 11:53 AM > To: [email protected] > Subject: [flexcoders] FDS Method Fill and List of parameters > > > > Hi, > > I put this request in my mapping : > > <query name="tasksProjects">From Task where idProject in (?)</query> > > I want to know how put in this call method to replace * : > > taskDataService.fill(tasksArray, "tasksProjects", [*]); > > The request must be like that : > > select * From Task where idProject in (1, 2, 3) > -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/flexcoders/ <*> Your email settings: Individual Email | Traditional <*> To change settings online go to: http://groups.yahoo.com/group/flexcoders/join (Yahoo! ID required) <*> To change settings via email: mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/

