Hibernate clues

I get it now.  In order to use Hibernate with Derby/Cloudscape, I need to use the “identity” generator:

<class name=”Location” table=”LOCATIONS” schema=”EARTHLINGS”>
    <id name=”id” type=”integer”>
        <generator class=”identity”>
    <property name=”address” column=”STREET_ADDRESS” />
    … other properties …

This makes sense, of course, since in the db build script I have

create table locations (
    id integer generated always as identity,
    street_address varchar(30),
    …  other column defs …

Now I can use this “earthlings” schema dreamed up by Capstone Courseware in my Hibernate class.

I also stumbled across a NoClassDefFoundError and fixed it by adding a jar file.

I’d say on my list of 10 Canonical Errors (the sequence of challenges I need to overcome to learn any new technology), I’m probably up through 7 now.  Getting there.

About Ken Kousen
I teach software development training courses. I specialize in all areas of Java and XML, from EJB3 to web services to open source projects like Spring, Hibernate, Groovy, and Grails. Find me on Google+ I am the author of "Making Java Groovy", a Java / Groovy integration book published by Manning in the Fall of 2013, and "Gradle Recipes for Android", published by O'Reilly in 2015.

One Response to Hibernate clues

  1. mm says:

    Thanks so much…your blog helped me resolve the problem of inserting into an auto incremented table….Thanks a bunch once again… 🙂

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: