Joined: Wed Jun 11, 2008 7:52 pm Posts: 1
|
Hi There,
I am using Struts+Spring+Hibernate in the application. I am prepopulating the values in the dropdown boxes by querying the database. It is taking a lot of time to get the values on the screen. Any help to improve the performance is highly appreciated. The below is the code -
Struts Form: I am calling this in resert method.
---------------
public List getCategories() {
return categoryService.getCategories();
}
CategoryDAOHibernate Class:
---------------------------------
public List getCategories(){
List categories=null;
try{
categories=getHibernateTemplate().find("select name from Category");
getSession().close();
} catch (Exception e) {
System.out.println("/nError***************while getting categories. "
+ e);
}
finally{
getSession().close();
}
return list;
}
category.hbm.xml
----------------------
<hibernate-mapping package="com.ambian.hd.hibernate.dto">
<class select-before-update="true" name="Category"
table="CATEGORY">
<cache usage="read-write" />
<id type="java.lang.Long" unsaved-value="null" column="ID">
<generator class="native" />
</id>
<property name="name" type="string" column="NAME"></property>
<property name="desc" type="string" column="DESCRIPTION"></property>
</class>
</hibernate-mapping>
|
|