A SessionFactory and a DataSource are different things. A SessionFactory is a Hibernate term; it is a class that provides Sessions based on a Configuration. A Session is a connection to a DataSource. DataSources are a
JDBC term, not a Hibernate term. They are supply a mechanism to connect to a database.
How you configure a SessionFactory is documented on the
Hibernate web site.
How you configure a DataSource depends on the container you are using. Which one are you using?