I do the following as stated in the documentation:
Context ctx = new InitialContext();
SessionFactory factory = (SessionFactory)ctx.lookup("java:/DefaultDS");
However the second line throws a ClassCastException because ctx.lookup
returns an Object of type: org.jboss.resource.adapter.jdbc.WrapperDataSource
so all I can do is:
DataSource ds = (DataSource)ctx.lookup("java:/DefaultDS");
How can I obtain a SessionFactory then?