-->
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.  [ 2 posts ] 
Author Message
 Post subject: repeated column on mapping multiple components
PostPosted: Thu Apr 14, 2005 7:25 am 
Newbie

Joined: Thu Apr 14, 2005 7:04 am
Posts: 1
I'm trying to map three components of the same class using hibernate components and different prefixes for each component. The problem is that the component class is used as a persistent class with its own table somewhere else in the project. That's why I get an error "Repeated column in mapping for entity: test.FallDaten column: VORNAME (should be mapped with insert="false" update="false")".
Is it possible to simultaneously map a class in its own table and use it as a component somewhere else?

The two components in class test.FallDaten:

/**
* @hibernate.component class="test.Person"
* prefix="WB1"
*/
public Person getWb1()
{
return wb1;
}

/**
* @hibernate.component class="test.Person"
* prefix="WB2"
*/
public Person getWb2()
{
return wb2;
}


The mapping of test.Person:

/**
* @hibernate.subclass discriminator-value="PERSON"
* @persistent
*/
public class Person {

...


/** @hibernate.property column="VORNAME" type="string" length="100" */
public String getVorname()
{
return vorname;
}

...

}


Hibernate version:

Mapping documents:

Code between sessionFactory.openSession() and session.close():

Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [applicationContextDSJndi.xml]: In
itialization of bean failed; nested exception is org.hibernate.MappingException: Repeated column in mapping for entity: test.FallDaten column: VORNAME (should be mapped with insert="false" update="false")
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:362)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:257)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:146)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:285)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:317)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:80)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:65)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:274)
at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:78)
... 13 more


Oracle


Top
 Profile  
 
 Post subject: Mapping the componnets
PostPosted: Thu Apr 14, 2005 11:02 am 
Beginner
Beginner

Joined: Wed Apr 21, 2004 8:33 am
Posts: 27
Hi,
Can you post the xml's. I guess the mapping isnt complete. When you are using one-many make sure to add attributes insert=false, update=false

thanks


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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.