singh
singh

Reputation: 309

please suggest about a basic example

any expert tell me where i find a basic example of Srtuts2+Spring+Hibernate

Upvotes: 0

Views: 162

Answers (3)

Alex Barnes
Alex Barnes

Reputation: 7218

This example is available on the Struts2 site.

Upvotes: 0

ebt
ebt

Reputation: 1358

I can help you with Hibernate.

Hibernate

  1. design a database, or take something off the shelf.

  2. download eclipse+ hibernate tools

  3. read instructions on how to setup hibernate, you can autogenerate your mapping + config files directly from the database.

  4. try some queries out in the HQL and Criteria editor (Eclipse)

  5. fire up Hyperion in your test app with code like this:

    public class SessionManager implements HibernateSessionManager {
        static final SessionFactory sessionFactory;
        static {
        try {       
            sessionFactory = new Configuration().configure("hibernate.cfg.xml").buildSessionFactory();
        } catch (Throwable e) {
            System.err.println("Error in creating SessionFactory object." 
            + e.getMessage());
            throw new ExceptionInInitializerError(e);
        }
        }
    

SessionManager.sessionFactory.OpenSession() will open a connection that you can run a query with.

once you get hibernate down then layer spring on top, then struts on top of that. trying to do it all at once is a lesson in frustration.

Upvotes: 2

Dejell
Dejell

Reputation: 14337

Struts2+spring+hibernate tutorial

Upvotes: 1

Related Questions