-->
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.  [ 1 post ] 
Author Message
 Post subject: one-to-one. What's the problem?
PostPosted: Thu Oct 05, 2006 5:13 pm 
Newbie

Joined: Tue Sep 19, 2006 7:07 pm
Posts: 9
I'm trying to map a one-to-one relationship. One of the sides is a inheritance (table for class hierarchy). So, I have the follow:

<hibernate-mapping>
<class name="dto.Concreto" table="Concreto">

<id name="codigoConc" column="codigo_conc" type="java.lang.Integer" unsaved-value="0" >
<generator class="native"/>
</id>

<discriminator column="concreto_type" type="java.lang.String"/>

<property ...

<subclass
name="dto.ConcretoF13"
discriminator-value="FCK13">
<property ...
</subclass>

<subclass
name="dto.ConcretoF15"
discriminator-value="FCK15">
<property ...
</subclass>

<subclass
name="dto.ConcretoF18"
discriminator-value="FCK18">
<property ...
</subclass>
</class>

It's working.
The other side is:

<class name="dto.Item_Compra" table="Item_Compra">

<id ...

<property ...

<one-to-one name="concreto" class="dto.Concreto"/>

</class>

I'm receiving the follow error message:

Initial SessionFactory creation failed.org.hibernate.MappingException: broken column mapping for: concreto.id of: dto.Item_Compra
Exception in thread "AWT-EventQueue-0" java.lang.ExceptionInInitializerError
at dto.HibernateUtil.<clinit>(HibernateUtil.java:20)
at dao.CompraDAO.getCompras(CompraDAO.java:16)
at view.Simulador.jButton1ActionPerformed(Simulador.java:72)
at view.Simulador.access$0(Simulador.java:65)
at view.Simulador$1.actionPerformed(Simulador.java:42)
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at javax.swing.plaf.basic.BasicButtonListener$Actions.actionPerformed(Unknown Source)
at javax.swing.SwingUtilities.notifyAction(Unknown Source)
at javax.swing.JComponent.processKeyBinding(Unknown Source)
at javax.swing.JComponent.processKeyBindings(Unknown Source)
at javax.swing.JComponent.processKeyEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.KeyboardFocusManager.redispatchEvent(Unknown Source)
at java.awt.DefaultKeyboardFocusManager.dispatchKeyEvent(Unknown Source)
at java.awt.DefaultKeyboardFocusManager.preDispatchKeyEvent(Unknown Source)
at java.awt.DefaultKeyboardFocusManager.typeAheadAssertions(Unknown Source)
at java.awt.DefaultKeyboardFocusManager.dispatchEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
Caused by: org.hibernate.MappingException: broken column mapping for: concreto.id of: dto.Item_Compra
at org.hibernate.persister.entity.AbstractPropertyMapping.initPropertyPaths(AbstractPropertyMapping.java:122)
at org.hibernate.persister.entity.AbstractPropertyMapping.initIdentifierPropertyPaths(AbstractPropertyMapping.java:176)
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)
at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:215)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1154)
at dto.HibernateUtil.<clinit>(HibernateUtil.java:16)
... 33 more

What's wrong?

PS: sorry for my bad english.


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

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.