I recently completed this tutorial: "http://static.springsource.org/docs/Spring-MVC-step-by-step/", but now I want it to work with Hibernate and annotations. I know I'm close but I've hit a roadblock and I can't figure it out. I've posted my code on the Spring forums here. I would greatly appreciate ANY help. Thanks
I'm trying to incorporate annotations and hibernate into it, but I've run into a problem and I can't figure it out. I keep getting errors of "No persistence unit with name 'product' found". ANY help would be greatly appreciated.
You need a META-INF/persistence.xml
, with <persistence-unit name="product">
. See here
(I usually put it in WEB-INF/classes/META-INF
. As noted in the comments, with maven you can place it in src/main/resources/META-INF
)
this is a example of file persistence.xml
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
version="2.0">
<persistence-unit name="poduct" transaction-type="RESOURCE_LOCAL">
</persistence-unit>
</persistence>
create this file inside "src/main/resources/META-INF" if you use Maven project.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With