Absolutely. Check out the Seam tutorials and documentation.
Also try the seam-gen utility. It will create an entire skeleton application for you including a class you can populate with whatever you want to do in order to log in the user (e.g. connect to the database in your example).
I forget if the class seam-gen creates is Authentication.java or Authorization.java (I always get the two mixed up), but its pretty obvious in the generated application, so you'll see it.
This is really a Hibernate question, but from my understanding you can't easily do this.
Actually its not really a Hibernate question but a JCA question.
My understanding is that it is possible in JBoss JCA though I have never done it.
It basically involves configuring the JCA datasource correctly.
Thanks for the directions. I will try with the JBoss JCA then.