Hi,

Freddy D. wrote:
> 
> Hi Dan,
> 
> Just a thought, maybe the problem resides in the location, or the
> contents,
> of the persistence.xml file?...I think Stripersist does a pretty good job
> of logging, so cranking it up
> to DEBUG might help.
> 
> Cheers,
> Freddy
> http://www.stripesbook.com
> 

I changed logging to debug, it appears there is something wrong with the
persistence.xml file. The debug message states: In order to call
Stripersist.getEntityManager() without any parameters there must be exactly
one persistence unit defined. When I specify the unit the message states:
Couldn't find EntityManagerFactory for persistence unit persistEx.

I'm following along with the Stripes book (chap. 12), and so there is only
one persistence unit, located in /WEB-INF/classes/META-INF; the only
difference between the book and my example is that I'm using postgresql
(rather than hsql). Please find below the my persistence.xml file; I've
racked my brains trying to find what is wrong with it, if someone sees the
error(s), let me know.

<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="persistEx">
                <provider>org.hibernate.ejb.HibernatePersistence</provider>
                <properties>
                        <property name="hibernate.archive.autodetection" 
value="class"/>
                        <property name="hibernate.dialect"
value="org.hibernate.dialect.PostgreSQLDialect"/>
                        <property name="hibernate.connect.driver_class"
value="org.postgresql.Driver"/>
                        <property name="hibernate.connection.url"
value="jdbc:postgresql://xxx.xxx.xxx.xxx:5432/sample"/>
                        <property name="hibernate.connection.username" 
value="user"/>
                        <property name="hibernate.connection.password" 
value="password"/>                       
                        <property name="jdbc.batch_size" value="0"/>
                        <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>

-Dan
-- 
View this message in context: 
http://www.nabble.com/Persistence-example-with-Stripersist%2C-JPA%2C-and-Hibernate-tp26067171p26083099.html
Sent from the stripes-users mailing list archive at Nabble.com.


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Stripes-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-users

Reply via email to