Viet,

Try setting:

<property name="openjpa.jdbc.SynchronizeMappings" value="false" />

I believe the default setting will rebuild your database and clear your tables.

As far as your data persisting, you will need to make sure you start a transaction and commit it after changing data.

Since you are using local transactions (in your persistence.xml), try:

em.getTransaction().begin();     // to start the transaction

and

em.getTransaction().commit();  // to close the transaction

I had the same problems when I started using JPA so hopefully that will work for you.


Jay
Viet Hung Nguyen wrote:
I am deploying my db pool through the admin console. I am using the tranql-connector-1.3.rar found under geronimo-jetty6-jee5-2.0-SNAPSHOT\repository\org\tranql\tranql-connector-ra\1.3.

I am still encountering these two problems:

1) The EJB seems to be talking to the DB, but whenever I query it, the data in the DB is erased. 2) In order to have some data in the DB I have added things to it dynamically. So when I fetch the data from the DB after this addition, the resultList is non-empty. However, when I try to view what I have just added by casting one element of the resultant list (that is of type Collection<ExchangeRate>) to an ExchangeRate object with this line:

   ExchangeRate rate = (ExchangeRate)ratesList.get(i);

I get a ClassCastException. Initially I thought ratesList might be null, but I have ensured that it is not.

For problem 1) I have read somewhere that there is a property I can set so that it does not overwrite the existing data in the DB, but I cannot remember what that is.

As for problem 2) I am out of ideas.

Thanks in advance,
Viet Nguyen


.

Reply via email to