From: ron p. (JIRA) <no...@at...> - 2006-05-22 14:04:13
|
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1771?page=comments#action_23143 ] ron piterman commented on HHH-1771: ----------------------------------- It is now (to me) that the one-to-one is not possible, changed to many-to-one and it works. PLEASE CLOSE. > Broken Column Mapping on one-to-one with foreign-key > ---------------------------------------------------- > > Key: HHH-1771 > URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1771 > Project: Hibernate3 > Type: Bug > Components: core > Versions: 3.1.3 > Reporter: ron piterman > Attachments: bug.zip > > > Here are the exception and the files: > ( added comments on the xml to ease reading ) > org.hibernate.MappingException: broken column mapping for: parentStateState.state of: com.pvs.pmm.client.state.StateNodeImpl > at org.hibernate.persister.entity.AbstractPropertyMapping.initPropertyPaths(AbstractPropertyMapping.java:122) > at org.hibernate.persister.entity.AbstractPropertyMapping.initIdentifierPropertyPaths(AbstractPropertyMapping.java:183) > at org.hibernate.persister.entity.AbstractPropertyMapping.initPropertyPaths(AbstractPropertyMapping.java:160) > at org.hibernate.persister.entity.AbstractEntityPersister.initOrdinaryPropertyPaths(AbstractEntityPersister.java:1585) > at org.hibernate.persister.entity.AbstractEntityPersister.initPropertyPaths(AbstractEntityPersister.java:1613) > at org.hibernate.persister.entity.AbstractEntityPersister.postConstruct(AbstractEntityPersister.java:2610) > at org.hibernate.persister.entity.SingleTableEntityPersister.<init>(SingleTableEntityPersister.java:386) > at org.hibernate.persister.PersisterFactory.createClassPersister(PersisterFactory.java:55) > <class name="StateNodeState"> > <composite-id name="id"> > <key-many-to-one name="parentNode"/> <!-- class="StateNodeImpl" --> > <key-property name="stateName"/> <!-- type="String"--> > </composite-id> > <one-to-one name="state" foreign-key="state" class="StateNodeImpl"/> > </class> > public class StateNodeState { > > private StateNodeStatePK id; > private StateNodeImpl state; > // here come setters and getters... > // ... > } > public class StateNodeStatePK implements Serializable { > > private StateNodeImpl parentNode; > private String stateName; > // here come setters and getters... > // ... > } > <class name="StateNodeImpl" table="StateNode"> > <id name="id"> <!-- Long --> > <generator class="foreign"> > <param name="property">parentStateState</param> > </generator> > </id> > <property name="stateName"/> > <property name="stateValue"/> > <one-to-one name="parentStateState" property-ref="state"/> <!-- class=StateNodeState --> > <many-to-one name="parentState"/> <!-- class="StateNodeImpl" --> > </class> > public class StateNodeImpl { > private Long id; > private String stateName; > private Long stateValue; > > private StateNodeImpl parentState; > private StateNodeState parentStateState; > // here comes auto generated setters and getters... > // ... > } > --- > I also tried without it without the <generator class="foreign"> and the reverse one-to-one from StateNode to StateNodeState, the result was the same. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira |