-->
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: Property type "object" not possible?
PostPosted: Mon Sep 05, 2005 10:58 pm 
Newbie

Joined: Mon Sep 05, 2005 10:52 pm
Posts: 6
Hi all,

I am attempting to create a class that has a property of type Object. So, I'm using a property tag with type="object", as stated in the reference, p. 58 under possible typenames. Yet when I deploy the mapping file, I get the error:

org.hibernate.MappingException: property mapping has wrong number of columns: com.simunex.snx.core.types.Attribute.value type: object

from the mapping file:

<property name="value" type="object"/>

It's probably something downright obvious, but I'm at a loss. If I change the type to anything but "object" (like serializable), it's fine.

Insight, please? Thanks!

--Scott


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 06, 2005 2:57 am 
Expert
Expert

Joined: Mon Jul 04, 2005 5:19 pm
Posts: 720
Can you post the rest of the mapping file?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 06, 2005 3:57 am 
Senior
Senior

Joined: Thu Aug 04, 2005 4:54 am
Posts: 153
Location: Birmingham, UK
How exactly do you expect the object to be stored in your DB? What DB are you using?

The point of serializable is that the object can be serialized for storage.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 06, 2005 11:08 am 
Newbie

Joined: Mon Sep 05, 2005 10:52 pm
Posts: 6
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping package="com.simunex.snx.core.types">
<class name="Attribute">
<id name="id">
<generator class="native"/>
</id>
<many-to-one name="type" column="typeId" class="AttributeType"/>
<property name="value" type="object"/>
</class>
</hibernate-mapping>

AttributeType (in case you need it):

<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping package="com.simunex.snx.core.types">
<class name="AttributeType">
<id name="id">
<generator class="native"/>
</id>
<property name="dataType" type="class"/>
<property name="name" type="string"/>
</class>
</hibernate-mapping>

jamie:

MySQL 4.1, and I know what the point of serializable is. The point is that the docs say that property type of "object" is valid, yet it isn't currently. Then what is the point of having type "object" if, in reality, "serializable" is supposed to mean a generic object (in the Java type sense). Maybe there is a real "object" datatype in some DBs (Oracle?), I forget. If so, there should be a better clarification of the available types.

Thanks!

--Scott


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.