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.  [ 4 posts ] 
Author Message
 Post subject: newbie: working with a set
PostPosted: Sun Dec 12, 2004 1:23 pm 
Newbie

Joined: Wed Nov 24, 2004 2:44 pm
Posts: 13
Hello,

I got an error if I try to save o object with a set:

Dec 13, 2004 6:27:55 PM net.sf.hibernate.util.ReflectHelper getBulkBean
INFO: reflection optimizer disabled for: ena.bl.Person, BulkBeanException: Cannot find specified property (property setAddress)
Dec 13, 2004 6:27:56 PM net.sf.hibernate.impl.SessionFactoryObjectFactory addInstance
INFO: Not binding factory to JNDI, no JNDI name configured
Hibernate: select hibernate_sequence.nextval from dual
Exception in thread "main" java.lang.ClassCastException: java.util.Vector


The Java class is:

public class Person extends BusinessObject {

public String Surname;
[...]

public Vector<Address> Address; // of Address
public Vector<CommunicationInfo> ComInfo; // of CommunicationInfo

public Person() {
super();
this.Address = new Vector<Address>();
this.ComInfo = new Vector<CommunicationInfo>();
}

public void setAddress(Address Adr) {
this.Address.add(Adr);
}

public void setCommunicationInfo(CommunicationInfo CI) {
this.ComInfo.add(CI);
}

[...]

What is wrong?

Regards Richard


Top
 Profile  
 
 Post subject:
PostPosted: Sun Dec 12, 2004 1:49 pm 
Newbie

Joined: Tue Jul 06, 2004 4:40 am
Posts: 9
Location: Slovakia
you have Vector... try Set
(and please post your hibernate mapping...)


Top
 Profile  
 
 Post subject:
PostPosted: Sun Dec 12, 2004 3:58 pm 
Newbie

Joined: Wed Nov 24, 2004 2:44 pm
Posts: 13
If I try a Set I get the same error. Anyway, here is the mapping file:

<hibernate-mapping package="ena.bl">

<class name="Person" table="Person">
<id name="id">
<generator class="native"/>
</id>
<property name="Client"/>

<property name="Surname"/>
[...]

<set
name="Address">
<key column="id"/>
<one-to-many class="ena.bl.Address"/>
</set>

<set
name="CommunicationInfo"
inverse="true"
cascade="all-delete-orphan">
<key column="id"/>
<one-to-many class="ena.bl.CommunicationInfo"/>
</set>
</class>
</hibernate-mapping>


Top
 Profile  
 
 Post subject:
PostPosted: Sun Dec 12, 2004 7:45 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
if you have a Set you can't get a classcastexception on Vector ;)

are you sure how you have recompiled the classes ?

_________________
Max
Don't forget to rate


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