tag:blogger.com,1999:blog-5601223690880447601.post4287737005253378620..comments2024-03-28T18:27:21.993+01:00Comments on blog.m1key.me: When Spring's jpaTemplate persist does not saveMichał Huniewiczhttp://www.blogger.com/profile/03904658492365257143noreply@blogger.comBlogger2125tag:blogger.com,1999:blog-5601223690880447601.post-46301069310930351262010-06-25T09:35:15.374+02:002010-06-25T09:35:15.374+02:00Hello Tomek, thanks for the comment!
Well it says ...Hello Tomek, thanks for the comment!<br />Well it says in bold that it exists as a sibling of JdoTemplate and HibernateTemplate, but it doesn't quite say I shouldn't be using it:<br />http://static.springsource.org/spring/docs/2.0.x/api/org/springframework/orm/jpa/JpaTemplate.html<br />Or does it? Is there an actual reason for me not to use it?<br />Is it because NOT using it is less Spring in my code?Michał Huniewiczhttps://www.blogger.com/profile/03904658492365257143noreply@blogger.comtag:blogger.com,1999:blog-5601223690880447601.post-29449779050726564302010-06-25T09:11:17.138+02:002010-06-25T09:11:17.138+02:00This is not actually a problem of JpaTemplate, but...This is not actually a problem of JpaTemplate, but JPA itself. If you use EntityManager directly, the same thing is going to happen (or actually - will not happen at all).<br /><br />But why are you using JpaTemplate on the first place? It's Javadoc states (in bold!) that you should prefer injecting EntityManger directly, which is both easier and standard way of working with JPA.Tomasz Nurkiewiczhttps://www.blogger.com/profile/05938011050162061962noreply@blogger.com