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.

By Ken Kousen

I am a Java Champion and the author of the books "Kotlin Cookbook", (O'Reilly Media), "Modern Java Recipes" (O'Reilly Media), "Gradle Recipes for Android" (O'Reilly Media), and "Making Java Groovy" (Manning), as well as over a dozen video courses at Safari Books Online. I'm a regular member of the No Fluff, Just Stuff conference tour and have given talks all over the world. Through my company, Kousen IT, Inc, I've taught training courses to and worked with thousands of developers.

1 reply on “Hibernate clues”

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.