This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Object Relational Mapping and the fly likes JodaTime Map Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "JodaTime Map" Watch "JodaTime Map" New topic
Author

JodaTime Map

Alesandro Lang
Greenhorn

Joined: May 20, 2011
Posts: 5
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

Joined: May 20, 2011
Posts: 5
@CollectionOfElements is deprecated now Iam using @ElementCollection

-> org.hibernate.MappingException: collection index mapping has wrong number of columns
Alesandro Lang
Greenhorn

Joined: May 20, 2011
Posts: 5
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.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: JodaTime Map
 
Similar Threads
Improving An Algorithm
Dynamic Generic Type
ClassCast exception
[Hibernate] Mapping a Map question
Doubt regarding maps key type while bnding