Thanks for superbly quick answer.

I've read the article you've been referencing. Actually I found it
earlier, but I did not help me, since the problem is elsewhere.

Yes, I know I cannot use container managed EntityManager. Tomcat does
not support JTA, ok. But I should be able, also the article points it
out, to use application managed EntityManager with RESOURCE_LOCAL
transaction type. Just like in SE java.

In SE java everything works just fine for me. Actually the code looks
just as in that article:

EntityManagerFactory emf =
Persistence.createEntityManagerFactory("insolvencePU");
EntityManager em = emf.createEntityManager();
em.getTransaction().begin();

//and the rest of transaction.

my persistence.xml looks like:

<persistence version="1.0"
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";>
  <persistence-unit name="insolvencePU" transaction-type="RESOURCE_LOCAL">
    <provider>org.hibernate.ejb.HibernatePersistence</provider>

    many classes here

    <properties>
      <property name="hibernate.connection.username" value="user"/>
      <property name="hibernate.connection.driver_class"
value="oracle.jdbc.OracleDriver"/>
      <property name="hibernate.connection.password" value="pass"/>
      <property name="hibernate.connection.url"
value="jdbc:oracle:thin:@//localhost:1521/AlfonzDB"/>
      <property name="hibernate.cache.provider_class"
value="org.hibernate.cache.NoCacheProvider"/>
      <property name="hibernate.dialect"
value="org.hibernate.dialect.Oracle10gDialect"/>
    </properties>
  </persistence-unit>
</persistence>


--- Now back to web app in tomcat:

Line
EntityManagerFactory emf =
Persistence.createEntityManagerFactory("insolvencePU");
fires an Exception complaining about unability to build
EntityManagerFactory. That leads me to suspicion that either the
persistence.xml, the data source or "something-else" is wrong. But I'm
quite to unable to find out what.

Could you help me with that configuration? Just ask me for anything
you need to know to be able to create valid configuration for tomcat 6
(if those information from posted persistence.xml are not sufficient).

thank you.
martin.

2011/2/20 Caldarale, Charles R <chuck.caldar...@unisys.com>:
>> From: Martin Mucha [mailto:alfon...@gmail.com]
>> Subject: datasource & persistenceUnit configuration
>
>> I got here WebApp, using JPA. I need to configure Tomcat
>> somehow, to be able to get EntityManager.
>
> Tomcat itself does not supply an EntityManager, as it is only a servlet 
> container, not a full Jave EE implementation.
>
> This article might be of interest:
> http://blogs.sun.com/pblaha/entry/using_toplink_persistence_ri_in
>
> If that's not what you need, you'll need to explain your problem in more 
> detail.
>
>  - Chuck
>
>
> THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY 
> MATERIAL and is thus for use only by the intended recipient. If you received 
> this in error, please contact the sender and delete the e-mail and its 
> attachments from all computers.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to