changing the format of date inside the list
I am using the below native sql query which ulimately transform the result
into aaa pojo type
List<aaa> uy = (List<aaa>)
session.createSQLQuery(Sql).addScalar("name",Hibernate.STRING).addScalar("BBB",Hibernate.STRING).addScalar("updated_by",Hibernate.STRING).addScalar("updateddate",Hibernate.TIMESTAMP).setResultTransformer(new
AliasToBeanResultTransformer(aaa.class)).list();
Now the issue is with addScalar("updateddate",Hibernate.TIMESTAMP) as I
want that in list in all the instances of aaa to be set as 20110817 17:12
, it rite now inside list in every instance of aaa is set as timestamp
which I dint't want please advise how can i set this into my desired
format in every instance of aaa in the list uy.. in list uy in every
instance of aaa it comes at 4th poistion.(index) so i have to pass the
list to a method and that will do the transformation for me please advise
how to achieve this.. something like this iwant to achieve..
Object b =(((Object[]) aaa)[++i]);
if (b != null)
{
Date s = ((java.util.Date) b);
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd
HH:mm");
String s1 = sdf.format(s);
u1.setUpdateddateformat(s1);
DateTime dt1 = new DateTime(s);
u1.setUpdated(dt1);
No comments:
Post a Comment