-->
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: Table Per Class exception
PostPosted: Sun Nov 06, 2005 1:13 am 
Senior
Senior

Joined: Tue Sep 13, 2005 2:01 am
Posts: 137
I was using Single Table mapping
@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
It was working fine.

After I changed it to Table per class,
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)

I got the following exception when trying to loading data:

Exception in thread "HSQLDB Connection @170c7a3"
java.lang.ClassCastException: java.lang.Integer
at org.hsqldb.rowio.RowOutputBase.writeData(Unknown Source)
at org.hsqldb.Result.write(Unknown Source)
at org.hsqldb.Result.write(Unknown Source)
at org.hsqldb.ServerConnection.run(Unknown Source)
at java.lang.Thread.run(Thread.java:595)

I tried both MySQL and HyperSonic.
Any ideas? any help is appreciated.

Thanks, David


Top
 Profile  
 
 Post subject:
PostPosted: Sun Nov 06, 2005 3:46 am 
Expert
Expert

Joined: Mon Jul 04, 2005 5:19 pm
Posts: 720
after changing @Inheritance, did you also make the appropriate changes in the data model?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 07, 2005 6:35 pm 
Senior
Senior

Joined: Tue Sep 13, 2005 2:01 am
Posts: 137
Thanks!

It is running OK now with MySQL without any changes. I do not know how it happend. Maybe some table data were not cleaned up.


For table per class, if I use AUTO for id generation,
@Id(generate = GeneratorType.AUTO)

I got the following deployment exception:

org.hibernate.MappingException: Cannot use identity column key generation with <union-subclass> mapping for: example.Cat.

If I change it to Table:
@Id(generate = GeneratorType.Table)
It works fine.

All DBs support AUTO. For Table Per class, which one should I use? There are some others: Identity, sequence, none.

I tried to look for docs, none can be found on internet. The Javadoc
is really not very nice, no docs, just names. :-)


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 09, 2005 7:45 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
you cannot use identity that's all

_________________
Emmanuel


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.