vlad2005
Jun 18th, 2009, 05:07 PM
i have an class that implement HibernateDaoSupport.
I use annotations, and my class expose service for flex. So i have something like this
@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:
@Autowired
private SessionFactory sessionFactory;
I try'it to expose class as bean, using an AppConfig class, with @Bean
@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.
I use annotations, and my class expose service for flex. So i have something like this
@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:
@Autowired
private SessionFactory sessionFactory;
I try'it to expose class as bean, using an AppConfig class, with @Bean
@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.