• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

unmapped class java.util.Date

 
Konstantin Surzhin
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
private Map<Rank, java.util.Date> rank;

<map name="rank" table="gamer2rank" >
<key column="gamer_id" not-null="true"/>
<map-key-many-to-many column="rank_id" class="Rank"/>
<element column="rank_date" type="date"/>
</map>

OK
-----------------------------------
@OneToMany
@MapKeyJoinColumn(name = "rank_id")
private Map<Rank, Date> rank;

Initial SessionFactory creation failed.org.hibernate.AnnotationException: Use of @OneToMany or @ManyToMany targeting an unmapped class: Gamer.rank[java.util.Date]

How to mapping Map<Rank, java.util.Date> rank using annotations?

Something like that, but for element tag.
https://docs.jboss.org/hibernate/orm/3.6/reference/en-US/html/collections.html#collections-ternary
 
Roel De Nijs
Sheriff
Posts: 10662
144
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Konstantin Surzhin,

First of all, a warm welcome to CodeRanch!

Konstantin Surzhin wrote:How to mapping Map<Rank, java.util.Date> rank using annotations?

Have you already read the Maps section of the Java Persistence WikiBook?

Kind regards,
Roel
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic