Re: [5.1.0.5] Ars-Machina - No service Implements the interface org.hibernate.SessionFactory
Thiago H. de Paula Figueiredo escribió: Em Mon, 25 May 2009 12:43:17 -0300, Antonio Fernández amiguel.fernan...@gmail.com escreveu: Hi again, Hi! * org.hibernate.HibernateException: No CurrentSessionContext configured! The suggested way is to override getSession() to return something other than sessionFactory.getSession() or set a CurrentSessionContext in you SessionFactory (recommended). This section in the Hibernate documentation tells you why and how: http://docs.jboss.org/hibernate/stable/core/reference/en/html_single/#architecture-current-session. . I tried with the three available values for property hibernate.current_session_context_class, it only works with value org.hibernate.context.ThreadLocalSessionContext. However, a new problem * org.hibernate.HibernateException: createCriteria is not valid without active transaction Hide uninteresting stack frames Stack trace * org.hibernate.context.ThreadLocalSessionContext$TransactionProtectionWrapper.invoke(ThreadLocalSessionContext.java:338) * $Proxy68.createCriteria(Unknown Source) * br.com.arsmachina.dao.hibernate.ReadableDAOImpl.createCriteria(ReadableDAOImpl.java:267) * br.com.arsmachina.dao.hibernate.ReadableDAOImpl.findAll(ReadableDAOImpl.java:125) * br.com.arsmachina.dao.hibernate.GenericDAOImpl.findAll(GenericDAOImpl.java:94) * $UserDAO_1217e966a63.findAll($UserDAO_1217e966a63.java) * org.jwp.ic20.pages.admin.user.UserShowAll.getUsers(UserShowAll.java:39) * $PropertyConduit_1217e966a93.get($PropertyConduit_1217e966a93.java) * org.apache.tapestry5.internal.bindings.PropBinding.get(PropBinding.java:58) My AppModule already includes the following contribution for decorating all the DAO services : @Match(*DAO) public static T T decorateTransactionally(HibernateTransactionDecorator decorator, ClassT serviceInterface, T delegate, String serviceId) { return decorator.build(serviceInterface, delegate, serviceId); } So at this point would require a deeper understanding of tapestry-hibernate. Greetings, Antonio A few changes in BaseHibernateDAO : - Replaced the import of class org.hibernate.classic.Session with org.hibernate.Session. Thanks for pointing me that. I've just fixed this in the Generic DAO-Hibernate branch. By the way, in the Maven repository, there is an improved 1.1 version there. - Add the org.hibernate.Session object as a new paremeter in all the constructor methods. - Changes in class BaseHibernateDAO : Add new field of type org.hibernate.Session, that will be initialized inside the constructor ( like the SessionFactory does ) Modify the method getSession(), returning the new field reference These modifications aren't appropriate to *Generic* DAO-Hibernate, as they wouldn't work without Tapestry-IoC (for example, when you're building a desktop application or using Spring), and this package is meant to be independetly from Tapestry-IoC. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
[5.1.0.5] Ars-Machina - No service Implements the interface org.hibernate.SessionFactory
Hi all , I´m trying to use te modules Ars-Machina generic-dao generic-dao-hibernate, but i´m getting the following message : * No service implements the interface org.hibernate.SessionFactory* I attach my current pom.xml, the following are the unique dependencies from the ars-machina project. ... dependency groupIdbr.com.arsmachina/groupId artifactIdgeneric-dao/artifactId version${ars-machina-release-version}/version /dependency dependency groupIdbr.com.arsmachina/groupId artifactIdgeneric-dao-hibernate/artifactId version${ars-machina-release-version}/version /dependency ... ( ...with ars-machina-release-version1.0/ars-machina-release-version ...) ¿ Any addicional dependency for get working ? I will try making my own builder method that returns an instance of SessionFactory, getting the instance from one of the services provided the tapestry-hibernate module. Thanks Nice.Day Antonio project xsi:schemaLocation=http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; xmlns=http://maven.apache.org/POM/4.0.0; modelVersion4.0.0/modelVersion groupIdorg.jwp/groupId artifactIdt5lab/artifactId version0.0.1-SNAPSHOT/version packagingwar/packaging nameic20 Tapestry 5 Application/name dependencies dependency groupIdorg.apache.tapestry/groupId artifactIdtapestry-core/artifactId version${tapestry-release-version}/version /dependency dependency groupIdorg.apache.tapestry/groupId artifactIdtapestry-hibernate/artifactId version${tapestry-release-version}/version /dependency dependency groupIdorg.apache.tapestry/groupId artifactIdtapestry-upload/artifactId version${tapestry-release-version}/version /dependency !-- dependency groupIdorg.apache.tapestry/groupId artifactIdtapestry-fileupload/artifactId version${tapestry-release-version}/version /dependency -- !-- A dependency on either JUnit or TestNG is required, or the surefire plugin (which runs the tests) will fail, preventing Maven from packaging the WAR. Tapestry includes a large number of testing facilities designed for use with TestNG (http://testng.org/), so it's recommended. -- dependency groupIdorg.testng/groupId artifactIdtestng/artifactId version5.8/version classifierjdk15/classifier scopetest/scope /dependency dependency groupIdorg.easymock/groupId artifactIdeasymock/artifactId version2.4/version scopetest/scope /dependency !-- May conflict with RunJettyRun inside Eclipse. tapestry-test brings in Selenium, which is based on Jetty 5.1; RunJettyRun uses Jetty 6. -- dependency groupIdorg.apache.tapestry/groupId artifactIdtapestry-test/artifactId version${tapestry-release-version}/version scopetest/scope /dependency !-- Provided by the servlet container, but sometimes referenced in the application code. -- dependency groupIdjavax.servlet/groupId artifactIdservlet-api/artifactId version2.5/version scopeprovided/scope /dependency !-- MYSQL Jdbc Driver -- dependency groupIdmysql/groupId artifactIdmysql-connector-java/artifactId version5.1.6/version /dependency !-- Chenillekit : Services and Components Library -- dependency groupIdorg.chenillekit/groupId artifactIdchenillekit-tapestry/artifactId version${chenillekit-release-version}/version /dependency dependency groupIdorg.chenillekit/groupId artifactIdchenillekit-mail/artifactId version${chenillekit-release-version}/version /dependency dependency groupIdorg.chenillekit/groupId artifactIdchenillekit-hibernate/artifactId version${chenillekit-release-version}/version /dependency !-- Hibernate-Tools -- dependency groupIdorg.hibernate/groupId artifactIdhibernate-tools/artifactId version3.2.0.ga/version /dependency dependency groupIdbr.com.arsmachina/groupId artifactIdgeneric-dao/artifactId version${ars-machina-release-version}/version /dependency dependency groupIdbr.com.arsmachina/groupId artifactIdgeneric-dao-hibernate/artifactId version${ars-machina-release-version}/version /dependency /dependencies build finalNameic20/finalName plugins plugin groupIdorg.apache.maven.plugins/groupId artifactIdmaven-compiler-plugin/artifactId
Re: [5.1.0.5] Ars-Machina - No service Implements the interface org.hibernate.SessionFactory
On Mon, May 25, 2009 at 6:58 AM, GMAIL1 amiguel.fernan...@gmail.com wrote: Hi all , Hi! I´m trying to use te modules Ars-Machina generic-dao generic-dao-hibernate, but i´m getting the following message : Nice to see that someone besides me is using the Ars Machina Project packages. :) No service implements the interface org.hibernate.SessionFactory* These packages don't have a dependency on Tapestry-IoC, so they don't provide a SessionFactory service to T-IoC. Any addicional dependency for get working ? I will try making my own builder method that returns an instance of SessionFactory, getting the instance from one of the services provided the tapestry-hibernate module. I've never used Tapestry-Hibernate myself, but I guess that'll work. :) -- Thiago - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: [5.1.0.5] Ars-Machina - No service Implements the interface org.hibernate.SessionFactory
Hi again, I tried adding the following builder method : public static SessionFactory buildSessionFactory(final HibernateSessionManager hibernateSessionManager) { return hibernateSessionManager.getSession().getSessionFactory(); } And T5 returns ... throwables * org.hibernate.HibernateException: No CurrentSessionContext configured! Stack trace * org.hibernate.impl.SessionFactoryImpl.getCurrentSession(SessionFactoryImpl.java:572) * $SessionFactory_1217831619b.getCurrentSession($SessionFactory_1217831619b.java) * br.com.arsmachina.dao.hibernate.BaseHibernateDAO.getSession(BaseHibernateDAO.java:111) * br.com.arsmachina.dao.hibernate.ReadableDAOImpl.createCriteria(ReadableDAOImpl.java:267) * br.com.arsmachina.dao.hibernate.ReadableDAOImpl.findAll(ReadableDAOImpl.java:125) * br.com.arsmachina.dao.hibernate.GenericDAOImpl.findAll(GenericDAOImpl.java:94) * $UserDAO_1217831614a.findAll($UserDAO_1217831614a.java) I attached my custom implementations of the package br.com.arsmachina.dao.hibernate , now i have working ars-machina.generic-dao-hibernate and tapestry-hibernate modules together . A few changes in BaseHibernateDAO : - Replaced the import of class org.hibernate.classic.Session with org.hibernate.Session. - Add the org.hibernate.Session object as a new paremeter in all the constructor methods. - Changes in class BaseHibernateDAO : Add new field of type org.hibernate.Session, that will be initialized inside the constructor ( like the SessionFactory does ) Modify the method getSession(), returning the new field reference By this way, the SessionFactory is Only used for his specific purposes and the Session is provided directly by the HibernateSessionManager service from tapestry-hibernate. That´s all , any suggestions, opinions.. Nice evening ! Antonio Thiago H. de Paula Figueiredo escribió: On Mon, May 25, 2009 at 6:58 AM, GMAIL1 amiguel.fernan...@gmail.com wrote: Hi all , Hi! I´m trying to use te modules Ars-Machina generic-dao generic-dao-hibernate, but i´m getting the following message : Nice to see that someone besides me is using the Ars Machina Project packages. :) No service implements the interface org.hibernate.SessionFactory* These packages don't have a dependency on Tapestry-IoC, so they don't provide a SessionFactory service to T-IoC. Any addicional dependency for get working ? I will try making my own builder method that returns an instance of SessionFactory, getting the instance from one of the services provided the tapestry-hibernate module. I've never used Tapestry-Hibernate myself, but I guess that'll work. :) - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: [5.1.0.5] Ars-Machina - No service Implements the interface org.hibernate.SessionFactory
Em Mon, 25 May 2009 12:43:17 -0300, Antonio Fernández amiguel.fernan...@gmail.com escreveu: Hi again, Hi! * org.hibernate.HibernateException: No CurrentSessionContext configured! The suggested way is to override getSession() to return something other than sessionFactory.getSession() or set a CurrentSessionContext in you SessionFactory (recommended). This section in the Hibernate documentation tells you why and how: http://docs.jboss.org/hibernate/stable/core/reference/en/html_single/#architecture-current-session. A few changes in BaseHibernateDAO : - Replaced the import of class org.hibernate.classic.Session with org.hibernate.Session. Thanks for pointing me that. I've just fixed this in the Generic DAO-Hibernate branch. By the way, in the Maven repository, there is an improved 1.1 version there. - Add the org.hibernate.Session object as a new paremeter in all the constructor methods. - Changes in class BaseHibernateDAO : Add new field of type org.hibernate.Session, that will be initialized inside the constructor ( like the SessionFactory does ) Modify the method getSession(), returning the new field reference These modifications aren't appropriate to *Generic* DAO-Hibernate, as they wouldn't work without Tapestry-IoC (for example, when you're building a desktop application or using Spring), and this package is meant to be independetly from Tapestry-IoC. -- Thiago H. de Paula Figueiredo Independent Java consultant, developer, and instructor http://www.arsmachina.com.br/thiago - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org