This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Object Relational Mapping and the fly likes How to catch exception while validating the username and password of a hibernate.cfg.xml Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "How to catch exception while validating the username and password of a hibernate.cfg.xml " Watch "How to catch exception while validating the username and password of a hibernate.cfg.xml " New topic
Author

How to catch exception while validating the username and password of a hibernate.cfg.xml

Kothandaraman Narashimman
Greenhorn

Joined: Jul 02, 2008
Posts: 4
Hi,

I do want to set the username and password dynamically in hibernate.cfg.xml

Here below is my configuration file.



Also im getting that session factory object like the below code.



So, in this above scenario, suppose if im giving the wrong password means exception should be caught and the string variable "GuigenserviceImpl.strAccpted" should be assigned to false.

But im getting the SQL Exception only in console like wrong username and password. And finally i couldn't able to catch the exception in Sessions class, static block.

Anyone can help me in catching that SQL Exception in my Sessions class and i need to handle that SQL Exception in my class.

Im getting this following exception message in my console.



Thanks in advance.

Thanks & Regards,
Kothandaraman N.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: How to catch exception while validating the username and password of a hibernate.cfg.xml
 
Similar Threads
Problem with inserting new data into database using hibernate
data insert error
session.flush(); gives null
Newbie got stuck in Hibernate "Hello World"
No Persistent Classes found for Query Class