Hello Gopal-,
            Hibernate is OR/Mapping tool which allows you to map java
data objects to relational database.
The documentation found in the hibernate.org is the best documentation I
have ever seen for a open source project so going thru that will help
you a lot. Basically everyone thinking that JDO is replacement for
entity beans in J2ee but each of them have theor own pros and cons it
depends on which way you gonna go.If you need further help in this one
feeel free to mail me off the list.

Thanks

Karuna

-----Original Message-----
From: Gopal Venkata Achi [mailto:[EMAIL PROTECTED] 
Sent: Monday, November 24, 2003 10:12 AM
To: Struts Users Mailing List
Subject: RE: Hibernate plugin


Hi David,
We are in the process of choosing the Hibernate for one of my
applications.  Can you let me know, how does it help us, and under what
circumstances, we use this tool.  I have gone thru the Hibernate docs,
but have not got the clear idea. Please help me in this regard. Regards,
gopal

        -----Original Message----- 
        From: David Friedman [mailto:[EMAIL PROTECTED] 
        Sent: Mon 11/24/2003 12:02 AM 
        To: Struts Users Mailing List 
        Cc: 
        Subject: RE: Hibernate plugin
        
        

        Mark,
        
        I have a simpler approach for Hibernate (v2.0.3 or v2.1 under
Struts v1.0 or
        v1.1)
        
        1. Start with the Hibernate example Struts PlugIn code and
struts-config.xml
        configuration text at:
        http://www.hibernate.org/105.html
        
        2. Do NOT put any context entries in server.xml or web.xml!
        
        3. Choose any name OTHER than the example
"java:comp/env/jdbc/mn-test".  Any
        name under "java:/comp" in Tomcat is read-only and cannot be
used.  I
        selected one using my initial and some related hibernate words
        "dgf:/hibernate/SessionFactory".  Put that in your
hibernate.cfg.xml file as
        the 'name="..."' parameter of the session-factory tag, along the
lines of
        this example:
        
        <session-factory name="dgf:/hibernate/SessionFactory">
                <!-- properties -->
                <!-- mapping files -->
                <mapping resource="hibernate/Misc.hbm.xml"/>
        </session-factory>
        
        If you use a hibernate.properties file, what you need is
described here:
        
http://www.hibernate.org/hib_docs/api/net/sf/hibernate/cfg/Environment.h
tml
        
        Since I use hibernate.cfg.xml instead of hibernate.properties,
I'm guessing
        you'll need something like this in your hibernate.properties
file:
        hibernate.jndi.url dgf:/hibernate
        hibernate.jndi.class javax.naming.Context
        hibernate.session_factory_name SessionFactory
        
        4. Hibernate creates the non-existent JNDI context for me on
webapp start
        and puts the session-factory in it.  My facade class opens the
session this
        way:
        
        Content ctx = new InitialContext();
        SessionFactory sf = (SessionFactory) ctx.lookup(jndiLocation);
        Session session = sf.openSession();
        
        That's all I do.  Oh, I'm using hibernate 2.1beta6 now for my
facade because
        it allows me to use named parameters in queries and hide the
hibernate types
        more easily.  (sorry, I think I read too much into Ted Husted's
Struts in
        Action book, I'm trying to facade EVERYTHING! LOL).
        
        Feel free to email me off-list if you need futher help.
        
        Regards,
        David
        
        
        -----Original Message-----
        From: Mark Lowe [mailto:[EMAIL PROTECTED]
        Sent: Monday, November 24, 2003 12:32 AM
        To: Struts Users Mailing List
        Subject: Hibernate plugin
        
        
        After spending all night pissing around with various hibernate
plugins
        to provide a datasource to use with hibernate?
        
        My JNDI datasource reports being okay in my container log,
        
        <Context path="/mn-test" docBase="mn-test" debug="5"
                                        reloadable="true"
crossContext="true">
                <Logger
className="org.apache.catalina.logger.FileLogger"
                                                        prefix="mn-test"
suffix=".log" timestamp="true" />
        
                <Resource name="jdbc/mn-test" scope="Shareable"
        type="javax.sql.DataSource" />
                <ResourceParams name="jdbc/mn-test">
        ..
        
        then in my hibernate.cfg.xml
        
        <property name="connection.datasource">
                java:comp/env/jdbc/mn-test
        </property>
        
        ...
        
        Every-time i try and get the datasource from the servlet context
I get
        a null pointer exception.. While this of course is a life
changing
        experience for me, i novelty is waring thin. If anyone has is
working
        in reality , then any input would be greatly appreciated.
        
        
        Cheers Mark
        
        
        
---------------------------------------------------------------------
        To unsubscribe, e-mail:
[EMAIL PROTECTED]
        For additional commands, e-mail:
[EMAIL PROTECTED]
        
        
        
---------------------------------------------------------------------
        To unsubscribe, e-mail:
[EMAIL PROTECTED]
        For additional commands, e-mail:
[EMAIL PROTECTED]
        
        


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to