• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Junilu Lacar
  • Paul Clapham
  • Knute Snortum
Saloon Keepers:
  • Stephan van Hulst
  • Ron McLeod
  • Tim Moores
  • salvin francis
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Vijitha Kumara

Hibernate sessionFactory is null  RSS feed

 
Ranch Hand
Posts: 630
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
SessionFactory is not being loaded. I think I know what the problem is , i just need someone else to confirm it.

I am using a mixture of autowire and xml, so my service bean is autowired, and calls FundRepository which is identified with the @Repository. But at the same time FundRepository is an XML defined Bean.
My question is, is it possible to mix autowired and XML defined beans ?.

Looking at my config I cant see anything wrong, but I have a hunch, that its not picking up the  FundRepository from the XML, because of the @Repository.


The spring context is


Called from a service nean
 
Bartender
Posts: 20562
120
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It is not only safe to mix annotated and XML-wired beans, it's a very specific feature. XML always overrides annotations, so if there's a conflict you know where to look. That way you can code in defaults and keep the XML to a minimum while still being able to override the defaults without changing the class source code.
 
Tony Evans
Ranch Hand
Posts: 630
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think the reverse is happening, because I have set my


Its overwriting the FundRepositoryImpl in my XML.

Is there a way to say dontoverwrite the FundRepositoryImpl in my XML.
 
Tony Evans
Ranch Hand
Posts: 630
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ok what I needed to do was the following for my config class I added a link to pick up my Spring.xml @ImportResource("classpath:/spring.xml")

 
Weeds: because mother nature refuses to be your personal bitch. But this tiny ad is willing:
global solutions you can do at home or in your backyard
https://www.kickstarter.com/projects/paulwheaton/better-world-boo
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!