Hello!!
I have this servlet:
protected void doProcess(
HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html");
PrintWriter out = response.getWriter();
SessionFactory sessionFactory;
Configuration config;
Session session;
try{
InitialContext context = new InitialContext();
sessionFactory = (SessionFactory)context.lookup("java:/hibernate/HibernateFactory");
config = new Configuration();
config.addClass(Persona.class);
sessionFactory = config.buildSessionFactory();
session = sessionFactory.openSession();
Persona p = (Persona)session.get(Persona.class,new Integer("52717995"));
if(p!=null){
out.println(p.toString());
}
else{
out.println("Nula");
}
}
catch(Exception e){
out.println("Error:"+e.toString());
}
}
}
When I run Jboss server, already take the properties of hibernate, but when I launch my application appears this exception:
Error:java.lang.UnsupportedOperationException: The user must supply a JDBC connection
and in the console appears:
15:52:26,815 INFO [Configuration] Mapping resource: Persona/Persona.hbm.xml
15:52:26,915 INFO [Binder] Mapping class: Persona.Persona -> persona
15:52:26,915 INFO [Configuration] processing one-to-many association mappings
15:52:26,925 INFO [Configuration] processing one-to-one association property references
15:52:26,925 INFO [Configuration] processing foreign key constraints
15:52:26,925 WARN [SettingsFactory] No dialect set - using GenericDialect: The dialect was not set. Set the property hibernate.dialect.
15:52:26,925 INFO [Dialect] Using dialect: net.sf.hibernate.dialect.GenericDialect
15:52:26,925 INFO [SettingsFactory] Use outer join fetching: false
15:52:26,925 WARN [UserSuppliedConnectionProvider] No connection properties specified - the user must supply JDBC connections
15:52:26,925 INFO [TransactionManagerLookupFactory] No TransactionManagerLookup configured (in JTA environment, use of process level read-write cache is not recommended)
15:52:26,925 INFO [SettingsFactory] Use scrollable result sets: false
15:52:26,925 INFO [SettingsFactory] Use JDBC3 getGeneratedKeys(): false
15:52:26,925 INFO [SettingsFactory] Optimize cache for minimal puts: false
15:52:26,925 INFO [SettingsFactory] Query language substitutions: {}
15:52:26,925 INFO [SettingsFactory] cache provider: net.sf.ehcache.hibernate.Provider
15:52:26,925 INFO [Configuration] instantiating and configuring caches
15:52:26,925 INFO [SessionFactoryImpl] building session factory
15:52:27,015 INFO [SessionFactoryObjectFactory] no JNDI name configured
Thanks!!!!
|