openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Scherer, Annette" <Annette.Sche...@huk-coburg.de>
Subject AW: data not written to database
Date Tue, 10 Feb 2009 08:51:34 GMT
In the meantime I fixed the error. I had to clear the context, to guarantee that the values
changed by the ChangeApp were recognized by the CompareApp. That means they are now read from
database, not from cache.

Now however I habe another Problem:
The WriteApp reads the differences from file an tries to write the changes to database per
update, insert or remove.  Thereby it logs this error:

ExceptionUtil E   CNTR0020E: EJB hat eine unerwartete (nicht deklarierte) Ausnahme beim Aufruf
der Methode "write" für Bean "BeanId(DomaenenWriteEJBEAR#DomaenenWriteTSEJB.jar#WriteTSEJB,
null)" ausgelöst. Ausnahmedaten: <openjpa-1.0.2-r420667:627158 fatal user error> org.apache.openjpa.persistence.InvalidStateException:
The context has been closed.  The stack trace at which the context was closed is available
if Runtime=TRACE logging is enabled.
        at org.apache.openjpa.kernel.BrokerImpl.assertOpen(BrokerImpl.java:4300)
        at org.apache.openjpa.kernel.BrokerImpl.beginOperation(BrokerImpl.java:1711)
        at org.apache.openjpa.kernel.BrokerImpl.newObjectId(BrokerImpl.java:1058)
        at org.apache.openjpa.kernel.DelegatingBroker.newObjectId(DelegatingBroker.java:252)
        at org.apache.openjpa.persistence.EntityManagerImpl.find(EntityManagerImpl.java:347)
        at de.huk.domaenen.write.WriteProcessorImpl.updateDomainValues(WriteProcessorImpl.java:108)
        at de.huk.domaenen.write.WriteProcessorImpl.update(WriteProcessorImpl.java:46)

Here the code snippet
private void updateDomainValues(Map<Integer, DomainValue> dvAendern){
        if (dvAendern != null) {
                Iterator<Integer> iter = dvAendern.keySet().iterator();
                while (iter.hasNext()) {
                        Integer actDVNr = (Integer) iter.next();
                        DomainValue sourceDV = dvAendern.get(actDVNr);
                        DomainValue targetDV = this.getEm().find(DomainValue.class, actDVNr);

                        targetDV.setSequence(sourceDV.getSequence());
                        targetDV.setValidFrom(sourceDV.getValidFrom());
                        targetDV.setValidTo(sourceDV.getValidTo());
                        targetDV.setValue(sourceDV.getValue());

                        System.out.println("updateDomainValues - " + actDVNr);
                }
        }
}


When starting the WriteApp once again, it works as expected.


How can I fix this wrong behavior

Thank You


Annette Scherer
Abteilung Informatik

HUK-COBURG
Bahnhofsplatz
96444 Coburg
Telefon  09561 96-1718
Telefax  09561 96-3671
E-Mail   Annette.Scherer@HUK-COBURG.de
Internet www.HUK.de
=============================================================
HUK-COBURG Haftpflicht-Unterstützungs-Kasse kraftfahrender Beamter Deutschlands a. G. in
Coburg
Reg.-Gericht Coburg HRB 100; St.-Nr. 9212/101/00021
Sitz der Gesellschaft: Bahnhofsplatz, 96444 Coburg
Vorsitzender des Aufsichtsrats: Werner Strohmayr.
Vorstand: Rolf-Peter Hoenen (Sprecher), Wolfgang Flaßhoff, Stefan Gronbach, Klaus-Jürgen
Heitmann, Dr. Christian Hofer, Dr. Wolfgang Weiler.
=============================================================


-----Ursprüngliche Nachricht-----
Von: Rick Curtis [mailto:curtisr7@gmail.com]
Gesendet: Montag, 9. Februar 2009 21:42
An: users@openjpa.apache.org
Betreff: Re: data not written to database


Annette --
Can we see a snippet of code from the CompareApp where the database read is
happening? ...this may be obvious, but is the ComareApp doing the read
during init?

Rick


Scherer, Annette wrote:
>
>
> Hello,
>
> I have two applications, both working with openJPA 1.0.2
> One of them (CompareApp) compares tabledata and writes differences to a
> file.
> The other (WriteApp) reads the differences from that file and writes them
> to database.
>
> The data to compare are changed by a third application (ChangeApp) which
> uses EJB2.1 and is not under my control.
>
>
>
> When a user has changed data with ChangeApp, CompareApp does not discover
> the changes. I have to stop and restart CompareApp. Then it works fine.
> But this is not the way, the Application should be used. The differences
> must be recognized without restarting the application.
>
> I use managed mode. Here is 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="DomaenenDB">
>                 <provider>
>
> org.apache.openjpa.persistence.PersistenceProviderImpl
>                 </provider>
>
> <jta-data-source>java:comp/env/jdbc/domaenendb</jta-data-source>
>                 <properties>
>                         <property name="openjpa.TransactionMode"
> value="managed"/>
>                         <property name="openjpa.ConnectionFactoryMode"
> value="managed"/>
>                         <property name="openjpa.jdbc.DBDictionary"
> value="db2"/>
>                         <property name="openjpa.jdbc.Schema" value="T7"/>
>                 </properties>
>         </persistence-unit>
> </persistence>
>
>
> Can someone give me an advice?
>
> Thank you
>
>
> Annette Scherer
> Abteilung Informatik
>
> HUK-COBURG
> Bahnhofsplatz
> 96444 Coburg
> Telefon  09561 96-1718
> Telefax  09561 96-3671
> E-Mail   Annette.Scherer@HUK-COBURG.de
> Internet www.HUK.de
> =============================================================
> HUK-COBURG Haftpflicht-Unterstützungs-Kasse kraftfahrender Beamter
> Deutschlands a. G. in Coburg
> Reg.-Gericht Coburg HRB 100; St.-Nr. 9212/101/00021
> Sitz der Gesellschaft: Bahnhofsplatz, 96444 Coburg
> Vorsitzender des Aufsichtsrats: Werner Strohmayr.
> Vorstand: Rolf-Peter Hoenen (Sprecher), Wolfgang Flaßhoff, Stefan
> Gronbach, Klaus-Jürgen Heitmann, Dr. Christian Hofer, Dr. Wolfgang Weiler.
> =============================================================
>
>
>

--
View this message in context: http://n2.nabble.com/data-not-written-to-database-tp2298689p2299286.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


Mime
View raw message