-->
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: problems with id generator
PostPosted: Wed Jan 07, 2004 5:33 pm 
Regular
Regular

Joined: Wed Jan 07, 2004 5:16 pm
Posts: 65
Location: CA, USA
I have a class mapped to a DB2 table, in which I am using the identity generator for the primary key.

In my mapping class I have something like this:

<hibernate-mapping>
<class
name="test.Example"
table="test"
>

<id
name="id"
column="id"
type="integer"
unsaved-value="0"
>
<generator class="identity">
</generator>
</id>

<property
name="someProperty"
type="int"
column="some_property"
/>
... etc ...


(the mapping was generated from Hibernate xdoclet tags.

When I try and save an instance of this class I get this exception:

net.sf.hibernate.MappingException: could not instantiate id generator
at net.sf.hibernate.id.IdentifierGeneratorFactory.create(IdentifierGeneratorFactory.java:82)
at net.sf.hibernate.mapping.SimpleValue.createIdentifierGenerator(SimpleValue.java:80)
at net.sf.hibernate.persister.AbstractEntityPersister.<init>(AbstractEntityPersister.java:630)
at net.sf.hibernate.persister.EntityPersister.<init>(EntityPersister.java:741)
at net.sf.hibernate.persister.PersisterFactory.createClassPersister(PersisterFactory.java:41)
at net.sf.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:136)
at net.sf.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:726)

...etc...

Caused by: java.lang.ClassNotFoundException:
at com.ibm.ws.classloader.CompoundClassLoader.findClass(CompoundClassLoader.java(Compiled Code))
at com.ibm.ws.classloader.CompoundClassLoader.loadClass(CompoundClassLoader.java(Compiled Code))
at java.lang.ClassLoader.loadClass(ClassLoader.java(Compiled Code))
at java.lang.Class.forName1(Native Method)
at java.lang.Class.forName(Class.java(Compiled Code))
at net.sf.hibernate.util.ReflectHelper.classForName(ReflectHelper.java:75)
at net.sf.hibernate.id.IdentifierGeneratorFactory.create(IdentifierGeneratorFactory.java:76)

I have a ClassNotFoundExcpetion, but the rest of the message is blank (ie I don't know what class it is looking for).

Has anyone else seen this? Any ideas on how I can resolve this?

Thanks,
Kevin Hooke


Top
 Profile  
 
 Post subject: fixed
PostPosted: Thu Jan 08, 2004 5:23 pm 
Regular
Regular

Joined: Wed Jan 07, 2004 5:16 pm
Posts: 65
Location: CA, USA
I found out this was caused by an empty generator-class attribute in my XDoclet tag for a completely unrelated class.

Lesson learnt today: check your xdoclet tags are valid :-)


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.