Jag Bains

Greenhorn
+ Follow
since Sep 08, 2005
Merit badge: grant badges
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Jag Bains

Hi,

I want to know if it is possible to get hold of the underlying sql exceptions when using enityManager to persist data.

In my example, I try to insert a duplicate row into the database, and I would like to receive a duplicate row exception.

Instead I get returned a javax.persistence.PersistenceException and embeded in the text is the sql exception :

Caught an exception javax.persistence.PersistenceException: Exception [TOPLINK-4002] (Oracle TopLink Essentials - 2.0.1 (Build b04-fcs (04/11/2008))): oracle.toplink.essentials.exceptions.DatabaseException
Internal Exception: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Duplicate entry '123' for key 2
Error Code: 1062

Is there anyway I can get the error code so that I can deal with the exception in the appropriate way.

My code is shown below:


Thanks
Hi,

I have a question on inheritance.

Say I have 3 classes

From the toString Method in Dog how do I call the toString method in Mammal. I have tried super and it seems to go straight to Animal class.

Am I missing something, or got something wrong in my code?

Cheers

Jag
[ September 12, 2005: Message edited by: Michael Ernest ]
17 years ago
Hi,

I have a servlet that posts a message to a stateless session bean, which inturn updates DB. The problem is that it always commits after each insert regardless to whether I have done a UserTransaction.Rollback or commit.

The Session bean is:



The UserTransaction and Context are create (call getIC() and getUT()) on calling the ejbCreate and ejbActivate methods.



the data-source.xml contains :


My ejb-jar.xml contains the following:



Can some please show me the errors of my ways.

Thanks.