RE: [flexcoders] FDS Method Fill and List of parameters

2006-11-02 Thread Jeff Vroom












I dont know for sure if this will
work with the current version of the hibernate assembler but it looks like it
might. Ill explain how it ought to work at least. Your AS
code would look like:



taskDataService.fill(tasksArray, tasksProjects,
[[1, 2, 3]]);



Since you are using positional parameters
(not named parameters), youd want to pass an array of parameters. In
this case, the first value in the array is itself an array of integers. In
Java, this array of integers should get turned into an Object[] containing Integer
objects. 



We provide the source code to the
hibernate assembler, so you can see that in the fill method of
that class, we are calling:




query.setParameter(position, paramValue);



In this case, paramValue ought to be the
Object[] above. I am hoping that hibernate is smart enough to detect the
array type and deal with it properly. If not, you might need to modify
the code it looks like in the hibernate api they have
query.setParameterList(name, Object[]) which might be a better
variant to use to tell hibernate to expect the array parameter. That
seems to only exist for named parameters so youd have to change your
query to use :name instead of ? for your parameter. 



Jeff











From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of jonathan_merey
Sent: Thursday, November 02, 2006
8:53 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] FDS Method
Fill and List of parameters











Hi,

I put this request in my mapping :

query name=tasksProjectsFrom 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








   






  
  
SPONSORED LINKS
  
  
  

Software development tool
  
  
Software development
  
  
Software development services
  
  


Home design software
  
  
Software development company
  

   
  






  
  Your email settings: Individual Email|Traditional 
  Change settings via the Web (Yahoo! ID required) 
  Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured 
   
Visit Your Group 
   |
  
Yahoo! Groups Terms of Use
   |
  
   Unsubscribe 
   
 

  




__,_._,___






RE: [flexcoders] FDS Method Fill and List of parameters

2006-11-02 Thread Cathy Reilly





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: flexcoders@yahoogroups.com 
[mailto:[EMAIL PROTECTED] On Behalf Of 
jonathan_mereySent: Thursday, November 02, 2006 11:53 
AMTo: flexcoders@yahoogroups.comSubject: [flexcoders] FDS 
Method Fill and List of parameters


Hi,I put this request in my mapping :query 
name="tasksProjects"From Task where idProject in 
(?)/queryI 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








   






  
  
SPONSORED LINKS
  
  
  

Software development tool
  
  
Software development
  
  
Software development services
  
  


Home design software
  
  
Software development company
  

   
  






  
  Your email settings: Individual Email|Traditional 
  Change settings via the Web (Yahoo! ID required) 
  Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured 
   
Visit Your Group 
   |
  
Yahoo! Groups Terms of Use
   |
  
   Unsubscribe 
   
 

  




__,_._,___