From: Al F. <for...@gm...> - 2013-05-08 13:52:59
|
Hi chris, I have tried with the latest and greatest (3.1.0.CR6), but no luck. I think the problem has to do with where the property is set. On the entityManager, the jpaProvider or the persistanceProvider (although I can't see any way to set anything on the persistence provider). localContainerEntityManagerFactoryBean.getPersistenceProvider(); http://static.springsource.org/spring/docs/3.2.x/javadoc-api/org/springframework/orm/jpa/LocalContainerEntityManagerFactoryBean.html If I don't figure it out then I'll setup a test case and open an issue. Just for info - it's Spring 3.2.2, Hibernate 4.2.1, and jadira 3.1.0.CR6. Thanks Al On 8 May 2013 15:04, Chris Pheby <ch...@ja...> wrote: > Al,**** > > ** ** > > Which release are you using? I have tested this with 3.1.0.CR6 and it is > working.**** > > I think this may be something to do with the way Spring configures > Hibernate. Can you provide a test case (e.g. a Maven project) for your > issue, and possibly attach to an issue (via the Jira at > http://jadira.atlassian.net/) and I’ll take a look?**** > > ** ** > > Regards Chris**** > > ** ** > > *From:* Al Forbes [mailto:for...@gm...] > *Sent:* 08 May 2013 14:41 > *To:* use...@li... > *Subject:* [Usertype-discuss] Joda, Spring, JPA with Auto register**** > > ** ** > > Hi,**** > > ** ** > > I'm using spring, JPA (with Hibernate) and Mysql. @Type works, but I'm > looking for a way to get the auto-registration working. Any hints > appreciated.**** > > ** ** > > The @Type annotation works:**** > > ** ** > > @Basic(optional = false) > @NotNull > @Column(name = "createdTs") > > @org.hibernate.annotations.Type(type="org.jadira.usertype.dateandtime.joda.PersistentLocalDateTime") > LocalDateTime created;**** > > ** ** > > I have been trying to get the auto-registration working, using the Java > configuration of Spring (using @Configuration):**** > > ** ** > > I tried setting the property on the EntityManager and the Hibernate JPA > adapter but neither seems to work.**** > > ** ** > > ** ** > > On the entity mananger:**** > > ** ** > > LocalContainerEntityManagerFactoryBean bean = > new LocalContainerEntityManagerFactoryBean(); > Map<String, Object> jpaProperties = bean.getJpaPropertyMap(); > jpaProperties.put("jadira.usertype.autoRegisterUserTypes", true); > bean.setJpaPropertyMap(jpaProperties);**** > > **** > > ** ** > > And on the adapter:**** > > ** ** > > HibernateJpaVendorAdapter jpaVendorAdapter = > new HibernateJpaVendorAdapter(); > jpaVendorAdapter.setDatabase(Database.valueOf(dbVendor)); > > jpaVendorAdapter.getJpaPropertyMap().put("jadira.usertype.autoRegisterUserTypes", > true);**** > > ** ** > > ** ** > > Thanks,**** > > Al **** > |