• 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.
 
my overalls have superpowers - they repel people who think fashion is important. Tiny ad:
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!