Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JodaTime Map

 
Alesandro Lang
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I want to save a java.util.Map to the Database with JPA. The Key Object is from org.joda.time.LocalDate the Value Object is an Integer. I tried a lot of stuff with the help of JodaTime-Hibernate.

e.G.


It would be great if there is a solution which is not hibernate specific.
 
Alesandro Lang
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
@CollectionOfElements is deprecated now Iam using @ElementCollection

-> org.hibernate.MappingException: collection index mapping has wrong number of columns
 
Alesandro Lang
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My workaround at the end of the day was to save java.util.Date and convert it to LocalDate .
I uses the @PrePersist and @PostLoad Annotations for this.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic