In our project, we have an entity 'Restaurant' with nearly 30 fields(some have relationships with other entities). So, every time we need a 'Restaurant' object even for a few fields, all the others are retrieved. This effects the performance. So, in the hbm file we wrote two classes both pointing to the same physical class and same table in database as shown below.
In one of the DAO implementations, we are using Criteria which takes 'RestaurantLite' and returning list of restaurants as we have to work with only restaurant objects as shown below.
Now we want to remove all hbm files and use annotations. So how the same can be done using annotations for entites? Do we need to create an extra class 'RestaurantLite'? If then, how the above criteria returns 'Restaurant' objects??
In Kathy and Bates book, it is given that "Once the control jumps to catch block from the try block, the balance part of the try block is never executed."
After a few paras, it is given that, "One of the benefits of using exception handling is that code to handle any particular exception that may occur in the governed region(try block) needs to be written only once. There may be three different places in our try block that can generate a particular exception, but wherever it occurs it will be handled by the same catch block."
My question is, if the control never returns from catch block, how can it handle the same exception in the remaining part of the try block?
Here is the error message:
Exception in thread "main" javax.mail.AuthenticationFailedException: failed to connect, no password specified?