1
persistent()는 예외없이 w/o를 리턴하지만 엔티티는 데이터베이스에 저장되지 않습니다.Spring MVC 3.0.5 컨트롤러에서 JPA 엔티티가 데이터베이스에 유지되지 않음
@RequestMapping(method = RequestMethod.POST)
public String form() {
EntityManager em = this.emf.createEntityManager();
TaxRates t = new TaxRates();
t.setCountry("US");
// set more properties
em.persist(t);
em.close();
...
}
의 persistence.xml :
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.0" 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">
<persistence-unit name="TT-SpringMVCPU" transaction-type="RESOURCE_LOCAL">
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
...
<class>com.sajee.db.TaxRates</class>
<exclude-unlisted-classes>true</exclude-unlisted-classes>
<properties>
<property name="javax.persistence.jdbc.url" value="jdbc:jtds:sqlserver://localhost:1234/mydb"/>
<property name="javax.persistence.jdbc.password" value="Password1"/>
<property name="javax.persistence.jdbc.driver" value="net.sourceforge.jtds.jdbc.Driver"/>
<property name="javax.persistence.jdbc.user" value="sa"/>
</properties>
</persistence-unit>
</persistence>
나는 어떤 트랜잭션 지원 또는 공상 기업의 기능 지원이 필요하지 않습니다. 엔티티를 만들고 데이터베이스에 저장하기 만하면됩니다.
어디로 잘못 가고 있습니까?