Programmatically setting sessionFactory and dataSource - help please!

A

ank

Guest
Hi,

I've got a complex, custom-configured hibernate setup in spring (including session factory definitions) that i want to use in grails 2.1.0. Because of that, I want to hand over a reference to the session factory and dataSource that i already have. So, i do not want (and in fact, can't) use hibernate.cfg.xml that's placed in conf/.

How would i do that? As I said, I have references to sessionFactory and to the db connection. How do i configure grails to use those and not try to create its own?

Ideally something like dataSource = ref('myDataSource') somewhere would be great - and the same with sessionFactory = ref('sessionFactory')

I've seen this too: eventDao(com.JavaClassRequiringDataSource) { dataSource = ref('dataSource') } but it does not work anymore.

Anyway, any help very very appreciated … i've spent the last 10 hours trying to get this to work…

Thanks :)
 
Top