Hi Hack,
I can do that using a sql query. In fact, i have done it using Hibernate and Spring DAO but inside the main method of my testClient class. What i am looking for is a way i can do this inside the execute() method of my action class.
Here is how i have done through main method:
Code:
package crud.model;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.context.support.FileSystemXmlApplicationContext;
public class TestClient {
public static void main(String[] args) {
ApplicationContext factory = new FileSystemXmlApplicationContext("src/main/resources/daoContext.xml");
AddressDAO addressDao = (AddressDAO)factory.getBean("addressDAO");
Address add1=new Address();
add1.setName("Raj4");
add1.setAddress("sector62");
add1.setCity("Noida");
add1.setState("UP");
add1.setZipcode("55555");
addressDao.add(add1);
Address address=addressDao.load(2);
System.out.println("welcome: Mr."+address.getName());
}
}
Bookmarks