Hi,
  Can u suggest me the best way to use datetime picker tag...It seems normal
Struts 2 Tag Library does not have this...
I try to follow the code dojo library,It's only displaying the label and not
displaying the datetime colander...When I try put the code <s:head
theme="ajax" /> I am getting the freemaker template error...What is the
cause for this..Please help me on this


Many Thanks and Regards,

Jerson
CPR Vision Management Pte Ltd
CRM Software & Marketing

E: jer...@cprvision.com
T: + (65) 6535 0996
F: + (65) 6327 8085
www.cprvision.com

CPR Vision - Nominated finalist for CRM, Marketing & Loyalty "Agency of the
Year" Award - Organized by Marketing Magazine


-----Original Message-----
From: CRANFORD, CHRIS [mailto:chris.cranf...@setech.com] 
Sent: Friday, February 18, 2011 11:23 AM
To: Struts Users Mailing List
Subject: RE: generate SQL Hibernate Query using session

Jerson -

What I would likely suggest you consider is creating a DTO object that
resembles your result from the SQLQuery.  You can then use one of the
stock Hibernate Transformers to convert the SQL results into instances
of this DTO Bean and then you can return the beans to your view to
iterate over.

Here's a simple example:

public List getQueryUsingResultTransformer() {
  SQLQuery query = session.createSQLQuery("SELECT SOME FANCY DATA");
  /* do other stuff */
  query.setResultTransformer(new
AliasToBeanResultTransformer(YourDTO.class));
  return(query.list());
}

Another alternative would be to iterate the result set yourself 

public List<YourDTO> getQueryDoingSelfInstantiation() {
  List<YourDTO> myList = new ArrayList<YourDTO>();
  SQLQuery query = session.createSQLQuery("SELECT SOME FANCY DATA");
  /* do other stuff */
  List results = query.list();
  Iterator i = results.iterator();
  while(i.hasNext())
  {
    Object[] row = (Object[]) i.next();
    /* each row has a 0-based index for each column of query */
    YourDTO dto = new YourDTO();
    /* set values on dto */
    myList.add(dto);
  }
  return(myList);
}

Both basically do the same; however I find that using the AliasToBean
transformer is much cleaner code :)

Chris

> -----Original Message-----
> From: Jerson John [mailto:jer...@cprvision.com]
> Sent: Thursday, February 17, 2011 7:43 PM
> To: user@struts.apache.org
> Subject: generate SQL Hibernate Query using session
> 
> Hi,
>   I am trying to generate SQL query using session.createSQLQuery and
> returning the list object..This select query contains joins and so it
> cannot
> be mapped to any of my model objects.How can I now get the values in
my
> jsp
> page using iterator tag in Struts 2...
> 
> Please help me on this
> 
> Many Thanks and Regards,
> 
> Jerson
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org

Reply via email to