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
The property tag fixed the overwriting of the DB problem. Thanks.
But I am using JTA, which is disallowing me to call
EntityManager.getTransaction(). It will throw an exception if I am using
JTA.
I just realized that because I wanted to use SQL queries instead, I have
to call EntityManager.createNativeQuery(), which takes two parameters
(one of which is the type) if I am using a SELECT statement. I did not
specify this, which is the cause of the Exception. Thanks David and Jay.
--Viet Nguyen