DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 3 of 3
  1. #1
    Join Date
    Apr 2008
    Posts
    3

    Question Hibernate/Spring DAO: store data in a table

    Hi all,

    I am new to spring/hibernate. I have a web application in which I have an employee details page wherein an employee enters his details. My application is based on struts framework and I am using hibernate and spring DAO for data manipulation. I am using MySQL database.

    Can anyone help me, how can I store the values entered in the employee details page to the employee table using Hibernate and Spring DAO. A sample piece of code would be appreciated.

    Regards,
    swaprk

  2. #2
    Join Date
    Apr 2007
    Location
    Sterling Heights, Michigan
    Posts
    8,649
    Can you execute an SQL query using what you are using?
    I don't answer coding questions via PM or Email. Please post a thread in the appropriate forum section.
    Please use [Code]your code goes in here[/Code] tags when posting code.
    Before posting your question, did you look here?
    Got a question on Linux? Visit our Linux sister site.
    Modifications Required For VB6 Apps To Work On Vista

  3. #3
    Join Date
    Apr 2008
    Posts
    3
    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());
    	}
    }

Similar Threads

  1. Importing SQL Table to the Data Grid
    By software_develo in forum .NET
    Replies: 5
    Last Post: 11-18-2005, 04:11 PM
  2. Replies: 1
    Last Post: 10-27-2005, 11:01 PM
  3. Attn: Daniel Reber
    By joe in forum Database
    Replies: 0
    Last Post: 04-04-2003, 05:25 PM
  4. Re: (No subject)
    By Joe in forum Database
    Replies: 0
    Last Post: 04-04-2003, 05:13 PM
  5. Ever store calculated data?
    By Mike in forum VB Classic
    Replies: 5
    Last Post: 12-13-2001, 06:22 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links