hey salvador just because you mention... i use gilead for treating my pojo's ... what about that HibernateDaoSupport... ?
On May 15, 10:43 am, Salvador Diaz <diaz.salva...@gmail.com> wrote: > We also use hibernate & spring for that kinds of things. Here's an > example (in a class extending HibernateDaoSupport): > > public List<Empleado> getObjects(Date startDate){ > DetachedCriteria criteria = DetachedCriteria.forClass > (Empleado.class); > criteria.add(Restrictions.ge("desde", startDate));//desde must be > the name of the field in your Empleado object > > List<Empleado> result = getHibernateTemplate().findByCriteria > (criteria); > > return result; > > } > > That's my recommended solution in Hibernate (notice that there are no > strings [besides the name of the field of course] just dates and > Empleados ;) ) > > Cheers, > > Salvador > > On 15 mai, 15:28, sindroide <efectob...@gmail.com> wrote: > > > thanks Salvador... what i trying to do is a query to postgres db in > > wich one of the parameters it's a date. > > And if i send the textual date of Date variable the query fails... > > because postgres can't compare the two dates. I solved my problem in > > query doing something like > > > "from Empleadosgrupos e where idgrupo =? and idempleado =? and desde > > =to_date('"+fechadesde+"', 'DD/mm/YYYY')") > > > I'm using hibernate and spring > > > but it's a bad solution for me.. don't know > > I'd like just to send the date as it is... a Date value with dd/mm/ > > yyyy ... in fact postgres has yyyy/mm/dd format but this difference > > seems doesn't mather for postgres > > > I really appreciate your help! > > > On May 15, 9:28 am, Salvador Diaz <diaz.salva...@gmail.com> wrote: > > > > > I need a Date variable (not a string) in the format 12/05/2009 for > > > > example. > > > > You're confusing things. A date is an object holding information about > > > an instant in time (typically this is represented internally as a > > > long), it has nothing to do with formats. Now, for a more thorough > > > explanation, go read the javadocs for the Date > > > object:http://java.sun.com/j2se/1.5.0/docs/api/java/util/Date.html > > > > > i only have a date variable like Tue May 12.... > > > > If you're using eclipse I'm guessing that you're talking about the > > > value that the "Variables" view in the "Debug" perspective shows for > > > your date. That's the result of the toString method of the Date > > > object, so it is only a specially formatted textual representation of > > > that object. You can format a Date object in almost any way you want > > > with a DateFormat instance in your server-side code (http:// > > > java.sun.com/j2se/1.5.0/docs/api/java/text/DateFormat.html) or with a > > > DateTimeFormat in client-side GWT code (http://google-web- > > > toolkit.googlecode.com/svn/javadoc/1.6/com/google/gwt/i18n/client/ > > > DateTimeFormat.html) > > > > Would you mind describing exactly what you're trying to accomplish ? > > > If it's doable in 2-3 lines of code somebody will eventually paste > > > that 2-3 lines of code and you'll have what you need. > > > > Hope that helps, > > > > Salvador > > > > On 15 mai, 14:11, sindroide <efectob...@gmail.com> wrote: > > > > > thanks for your replay mike, what i need it's quite simple but i still > > > > couldn't do it. > > > > I need a Date variable (not a string) in the format 12/05/2009 for > > > > example. > > > > I thought that getting a format with DateTimeFormat as "dd/MM/yyyy" > > > > and making a new date variable with that format i would have some dd/ > > > > mm/yyyy but i don't.... i only have a date variable like Tue May > > > > 12.... > > > > > The only case that i have something like dd/mm/yyyy is a string wich > > > > it anusefull for me. > > > > > Could you please help me! > > > > > On May 15, 12:00 am, mdwarne <mike.wa...@gmail.com> wrote: > > > > > > Hi sindroide, > > > > > Are you trying to change a Text String date, into another Text String > > > > > date? > > > > > > I'm not sure if I understand your needs. > > > > > > But, look at the static "parse" method in the Date class: > > > > > > Date d = Date.parse("Tue, xxxxxx"); > > > > > > String newDate = DateTimeFormat.getFormat("dd/MM/yyyy").format(d); > > > > > > Mike. > > > > > > On May 12, 3:28 am, sindroide <efectob...@gmail.com> wrote: > > > > > > > Hi, I can not get in anyway a Date value like 2009/05/12 from text > > > > > > like 'Tue May 12 00:00:00 ART 2009' > > > > > > The only way I can not get illegalArgumentexception es like > > > > > > > Date f = new Date(); > > > > > > > // this print like i want but it's text > > > > > > System.out.println(DateTimeFormat.getFormat("dd/MM/yyyy").format > > > > > > (f)); > > > > > > > //this prints date but ... in words format > > > > > > System.out.println(DateTimeFormat.getFormat("dd/MM/yyyy").parse > > > > > > (DateTimeFormat.getFormat("dd.MM.yyyy").format(f))); > > > > > > > cuold you please help me. Thanks for advance! --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to Google-Web-Toolkit@googlegroups.com To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/Google-Web-Toolkit?hl=en -~----------~----~----~----~------~----~------~--~---