I am using Spring boot 1.4.0, Spring data for repository layer and Hibernate for JPA.
When I use org.springframework.data.annotation.Transient
annotation on one of the entity field that I do not want to persist, it does not work.
When I use javax.persistence.Transient
, it works as expected(every annotation is from javax.persistence
package).
I have done a lot of readings of the documents but could not find out why. Please help me understand the difference, thank you.
Update
From the comment and answer below, I changed both @Id and @transient from javax.persistence
package to org.springframework.data.annotation
, it still produces error that says:
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaAutoConfiguration.class]: Invocation of init method failed; nested exception is org.hibernate.AnnotationException: No identifier specified for entity: com.xxx.domain.entities.PriceScheduleEntity
I guess I need to change all the annotations including @Column
, @Entity
, etc.. to the same vendor/provider/package to make it work. JPA and spring's annotations cannot mixed? I'll try and update later.