Announcement Announcement Module
Collapse
No announcement yet.
problem with @Service and sessionFactory Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • problem with @Service and sessionFactory

    i have an class that implement HibernateDaoSupport.
    I use annotations, and my class expose service for flex. So i have something like this
    Code:
    @Service("exportService")
    @RemotingDestination(channels = { "my-amf" })
    public class ExportService extends HibernateDaoSupport{
    ............................................................
    }
    How can instantiate sessionFactory for my class, using annotation?
    I try'it something like this in my class, but not work:
    Code:
    @Autowired
    private SessionFactory sessionFactory;
    I try'it to expose class as bean, using an AppConfig class, with @Bean
    Code:
           @Bean
    	public ViziteDao vizitebean()
    	{
    		ExportService v = new ExportService();
    		v.setSessionFactory(sessionFactory);
    		return v;
    	}
    Any variant not work. I got error about sessionFactory instantiate.
    Concurrently , i have another's classes with full implementation, service, dao, dao implementation, and everything work, but for this class, i have an simple operation, and i don't want to follow "god practice".
    So, how can instantiate sessionFactory for my class?
    P.S. I have an bean with id "sessionFactory", declared in applicationContext.
Working...
X