This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
While throwing EntityUniqueConstraintException , getMessage() throws entire statck trace like "insert into <table name> values(<column names>) schemaname.constraintname constarint violation exception
That's not a stack trace, it looks like an SQL statement template, presumably it's the statement that caused the exception to be thrown.
I need to get schemaname.constraintname constarint violation exception alone.
Not 100% sure what you mean by this.
If want to get an earlier exception that ultimately caused the EntityUniqueConstraintException to be thrown you can work your way down the cause stack by repeatedly calling getCause() on the exception returned from previous call to getCause() until you find an exception of the type you are looking for and then call getMessage() on it.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
subject: How to get exact error message from print stacktrace