This week's book giveaway is in the XML and Related Technologies forum.
We're giving away four copies of Java XML & JSON and have Jeff Friesen on-line!
See this thread for details.
Win a copy of Java XML & JSON this week in the XML and Related Technologies forum!
  • 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
  • Devaka Cooray
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Junilu Lacar
  • Paul Clapham
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • salvin francis
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Ganesh Patekar

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: 20307
110
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")

 
All of the world's problems can be solved in a garden - Geoff Lawton. Tiny ad:
RavenDB is an Open Source NoSQL Database that’s fully transactional (ACID) across your database
https://coderanch.com/t/704633/RavenDB-Open-Source-NoSQL-Database
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!