-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: Annotation not valid error when MapKey is an entity
PostPosted: Tue Mar 28, 2006 6:45 pm 
Newbie

Joined: Wed Oct 12, 2005 2:34 pm
Posts: 3
I have a map of forms in my Subject (e.g. person) class that uses a another entity as its key like so:

Code:
@ManyToMany (targetEntity=ConsentForm.class)
@MapKey( name="study" )
@JoinTable( name="SUBJECT_CONSENT_FORM",
                joinColumns = {@JoinColumn( name="SUBJECT_ID", nullable=false )},
                inverseJoinColumns = {@JoinColumn( name="CONSENT_FORM_ID", nullable=false)} )
private Map<Study, ConsentForm> completedConsentForms;


In my ConsentForm class, I have the "study" property like so:
Code:
@ManyToOne
@JoinColumn(name="STUDY_ID", nullable = false)
private Study study;


This study references the Study entity which is declared:
Code:
@Entity
@Table( name="STUDY" )
@SequenceGenerator( name="sequence", sequenceName="id_seq" )
public class Study { ... }


BUT I get the following error, when I try to build the annotation session factory:
Quote:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionManager' defined in class path resource [spring-core.xml]: Can't resolve reference to bean 'sessionFactory' while setting property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [spring-persistence-test.xml]: Initialization of bean failed; nested exception is org.hibernate.MappingException: Could not determine type for: edu.umich.med.cacr.hb.Study, for columns: [org.hibernate.mapping.Formula( STUDY_ID )]
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [spring-persistence-test.xml]: Initialization of bean failed; nested exception is org.hibernate.MappingException: Could not determine type for: edu.umich.med.cacr.hb.Study, for columns: [org.hibernate.mapping.Formula( STUDY_ID )]
org.hibernate.MappingException: Could not determine type for: edu.umich.med.cacr.hb.Study, for columns: [org.hibernate.mapping.Formula( STUDY_ID )]
at org.hibernate.mapping.SimpleValue.getType(SimpleValue.java:266)
at org.hibernate.mapping.SimpleValue.isValid(SimpleValue.java:253)
at org.hibernate.mapping.IndexedCollection.validate(IndexedCollection.java:68)
at org.hibernate.cfg.Configuration.validate(Configuration.java:988)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1169)
. . .


Has anyone seen this problem when using another entity as a MapKey? If I make the Map a Set or List, I no longer get the error.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 28, 2006 7:09 pm 
Newbie

Joined: Wed Oct 12, 2005 2:34 pm
Posts: 3
According to Jira issue ANN-113 (http://opensource.atlassian.com/project ... se/ANN-113), this is not supposed to be supported. Question: Even though it is not supposed to be supported, will it be supported.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 31, 2006 7:34 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
ANN-1
Patch welcome

_________________
Emmanuel


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.