views:

77

answers:

3

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

+1  A: 

Struts2+spring+hibernate tutorial

Odelya
+2  A: 

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.

ebt
A: 

This example is available on the Struts2 site.

Alex