JPA annotations
===============
import javax.persistence.Entity;
@Entity
@Table(name = "COURSE")
public class Course {
JPA-persist
===========
import javax.persistence.PersistenceContext;
import javax.persistence.EntityManager;
import org.springframework.transaction.annotation.Transactional;
public class JpaCourseDao implements CourseDao {
@PersistenceContext
private EntityManager entityManager;
@Transactional
public void store(Course course) {
entityManager.merge(course);
Hibernate as Engine
===================
[bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean"]
[property name="persistenceUnitName" value="course"/]
[property name="dataSource" ref="dataSource"/]
[property name="jpaVendorAdapter"]
[bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter"]
[property name="databasePlatform" value="org.hibernate.dialect.DerbyDialect"/]
No comments:
Post a Comment