Using spring and jpa, and you get this error:
No single default persistence unit defined in {classpath*:META-INF/persistence.xml}
And you DO have a persistence.xml in your classpath.
Then the cause is simple.
You may have other persistence.xml files as well in your lib/jars.
Solution, add your persistenceUnitName to entityManager bean.
<bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name="persistenceUnitName" value="blahblahYourName" />
which matches the one in your persistence.xml
<persistence-unit name="blahblahYourName">
</persistence-unit>
Thank you. You solved my problem ;)
you solve my problem...
I got it in a spring web flow app example
Perfect! Thanks :)
/bitte
Thanks!! This problem was driving me nuts... PB
This solved it. Thanks
thanks for this!
Thanks, this solved an issue I encountered some time ago as well!
You da man! Thanks for posting this!
thank you man!
Thank's a lot!!!
Nice solution
life saver !!
Is it possible to have multiple persistence unit in one persistence.xml file?
Thanks for the solution!
Solved my problem which only occured while trying to run the project with JRebel. Thanks!
Solved my problem. Thanks for the post.
thank you, Sir!
Solved conflicts between multiple war on the same server. Thank you !
Big Thank you, you rock !
modjo2010
Unless otherwise specified, all content is licensed under Creative Commons by Attribution 3.0 (CC-BY).
Externally linked images and content are not included and are licensed and copyrighted separately.
Comments
Comments below were made on a legacy Blog, before move to current Blog (February 2019)