Re: error in hibernate persistance service

"Michael Nash JGlobal.com" <[email protected]> Mon, 5 Jul 2004 15:25:28 -0400
Newsgroups gmane.comp.java.keel.user
Organization JGlobal
Message-ID <20040705152528.2f46ff47@jglobal>
Maurizio:

Just to toss my 2c worth into the conversation....

> I'm trying to sort things out, as I've realized I was building over 
> half-built configurations. So I decided that, in order to understand 
> which errors were caused by incoherent configurations, as I'm not 
> familiar with keel's build system, at every step, I'd clear it all and 
> build ex-novo the whole installation (with 'ant nonetinstall').

You definitely don't need a new "nonetinstall" for every clean and build. Once the main dependancies are installed, just an "ant clean", or, in special cases an "ant clean-keel" will start you from a clean slate. This should save you a lot of time.

> So here's what I'm up to:
> - default configuration, default persistence, hsqldb RDBMS: ok
> - default configuration, default persistence, mysql RDBMS: ok
> - default configuration, default persistence, DB2/400 RDBMS: dialect not 
> implemented, so I'll have to get back to it later.
> - default configuration, hibernate persistence, hsqldb RDBMS: when 
> running model 'createdb', app-poll gives error Could not return a 
> reference to the Component 
> (Key='org.keel.services.persist.PersistentFactory/*'). This time the 
> reason is following:
> GRAVE: Could not compile the mapping document
> net.sf.hibernate.MappingException: composite-id class must override 
> hashCode():
> org.keel.apps.poll.entity.CatSec
>         at net.sf.hibernate.cfg.Binder.bindRootClass(Binder.java:311)
>         at net.sf.hibernate.cfg.Binder.bindRoot(Binder.java:1243)
>         at net.sf.hibernate.cfg.Configuration.add(Configuration.java:249)
>         at net.sf.hibernate.cfg.Configuration.addXML(Configuration.java:206)
>         at 
> org.keel.services.persist.hibernate.HibernatePersistentFactory.initialize(HibernatePersistentFactory.java:297)
> So I remarked "app.poll=true" from ant.properties, rebuilt the whole 
> thing (always with ant nonetinstall after having deleted all that was to 
> be deleted in order to do a clean start) and model 'createdb' gave me 
> this other error:
> Unable to create database tables:null, Persistence exception while 
> creating default data for 'ids.ids', adding 
> name:ids.ids,table_name:ids,field_values:table_name=KeelListItem
> (btw, as far as I can see,  the definition of the ID table IS in 
> system.xconf)

The error you're seeing is from the portion of createdb where default data is inserted into the tables that have been created, so "ids" is there, but there's an error when populating it. You should find a detailed explanation of what the error is - my guess would be perhaps a duplicate key, but why that's happening I'm not certain.

To address your concerns, there's no question that Keel is more complex and harder to get started with than Expresso - but they are not really comparable on that level in any case, as Expresso is an "all in one" framework solution, whereas Keel combines the best of *many* frameworks into a single component-development "toolkit". In some sense, it's not a framework at all.

OTOH, you definitely should not have as much trouble installing Keel as you have, and I'm happy to jump in and assist. I don't personally use Hibernate (I find the default persistance layer easier to work with for my purposes), but I can quickly set up a test environment and try what you're trying. It's probably specific to the Hibernate connector, and I'd like to track it down and get it corrected.

Swapping services (e.g. authentication/authorization) is quite straightforward, but not all implementations are as mature as others - this is something we try to indicate with the version/release numbers in the "ant.properties" file in each module, just so you know which ones you can expect to be more stable (they'll have a higher version number, at least 1.0+)

HTH!

I'll give a try of the Hibernate build right now and see what I can find to help out...

Regards,
-- 
Michael Nash

JGlobal Ltd 
Next-Generation Web Application Development and Open Source Support
http://www.jglobal.com

Bahamas Commerce and Trade
Offshore eCommerce Hosting and Business Services
http://www.bahamascommerce.com