Alex,
You should be fine as long as you've only got a single web.xml per webapp. :) It is thread safe.

I'm on the stripes IRC channel most of the time if you'd like to have a more interactive discussion.

irc.freenode.net#stripes

Aaron

Alex Turner wrote:
I just discovered that you write stipernate, which I switched to to try and get something working, which I did, but I'm a bit concerned that by using a singleton to return a session, it's not thread safe. Should I be worried?

Alex

On Sun, Nov 2, 2008 at 2:37 AM, Aaron Porter <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>> wrote:

    Hi Alex,
    There is only one thing in web.xml that you need to set inside of
    your Stripes <filter>. You need to tell Stripes to load
    Stripersist as an extension with the following lines:

            <init-param>
                <param-name>Extension.Packages</param-name>
                <param-value>
                    org.stripesstuff.stripersist
                </param-value>
            </init-param>

    You may have other extensions too in which case you can separate
    the values with whitespace and/or commas.

    Aaron

    Alex Turner wrote:
    I'm basing my code on the code from the new stripes book, and
    Stripersist.getEntityManager() is returning null.  I get the
    following two lines in my log:

    1 [main] INFO org.hibernate.annotations.common.Version -
    Hibernate Commons Annotations 3.1.0.GA <http://3.1.0.GA>
    5 [main] INFO org.hibernate.ejb.Version - Hibernate EntityManager
    3.4.0.CR1

    Which gives me the impression that Hibernate Entity Manager is up
    and running, though I might be wrong.  I didn't see that it told
    me I had to add anything to my web.xml to make it work, though I
    was skimming pretty fast tonight, so I might have missed it.

    Thanks,

    Alex

    My persistence.xml:

    <persistence xmlns="http://java.sun.com/xml/ns/persistence";
                 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
    http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd";
                 version="1.0">
    <persistence-unit name="stripes_project-manager">
    <!-- Tell JPA to use Hibernate -->
    <provider>org.hibernate.ejb.HibernatePersistence</provider>
    <!-- Hibernate settings -->
    <properties>
    <!-- Autodetect entity classes -->
    <property name="hibernate.archive.autodetection" value="class"/>
    <!-- Automatically create the SQL schema -->
    <property name="hibernate.hbm2ddl.auto" value="update"/>
    <property name="hibernate.dialect"
    value="org.hibernate.dialect.PostgresqlDialect"/>
    <property name="hibernate.connection.driver_class"
    value="org.postgresql.Driver"/>
    <!-- Configure the JDBC database connection -->
    <property name="hibernate.connection.url"
    value="jdbc:postgresql://localhost/tmd"/>
    <property name="hibernate.connection.username" value="plexq"/>
    <property name="hibernate.connection.password" value=""/>
    <property name="jdbc.batch_size" value="0"/>
    <!-- Configure the connection pool -->
    <property name="hibernate.c3p0.min_size" value="5"/>
    <property name="hibernate.c3p0.max_size" value="20"/>
    <property name="hibernate.c3p0.timeout" value="300"/>
    <property name="hibernate.c3p0.max_statements" value="50"/>
    <property name="hibernate.c3p0.idle_test_period" value="3000"/>
    </properties>
    </persistence-unit>
    </persistence>
    ------------------------------------------------------------------------

    -------------------------------------------------------------------------
    This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
    Build the coolest Linux based applications with Moblin SDK & win great 
prizes
    Grand prize is a trip for two to an Open Source event anywhere in the world
    http://moblin-contest.org/redirect.php?banner_id=100&url=/ 
<http://moblin-contest.org/redirect.php?banner_id=100&url=/>
    ------------------------------------------------------------------------

    _______________________________________________
    Stripes-users mailing list
    [email protected] 
<mailto:[email protected]>
    https://lists.sourceforge.net/lists/listinfo/stripes-users


    -------------------------------------------------------------------------
    This SF.Net email is sponsored by the Moblin Your Move Developer's
    challenge
    Build the coolest Linux based applications with Moblin SDK & win
    great prizes
    Grand prize is a trip for two to an Open Source event anywhere in
    the world
    http://moblin-contest.org/redirect.php?banner_id=100&url=/
    <http://moblin-contest.org/redirect.php?banner_id=100&url=/>
    _______________________________________________
    Stripes-users mailing list
    [email protected]
    <mailto:[email protected]>
    https://lists.sourceforge.net/lists/listinfo/stripes-users


------------------------------------------------------------------------

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
------------------------------------------------------------------------

_______________________________________________
Stripes-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-users

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Stripes-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-users

Reply via email to