db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From przyb...@engr.arizona.edu
Subject Hibernate/Derby subsequent insert fails.
Date Tue, 07 Jun 2005 21:18:51 GMT
Hello all,


Does anyone out there use Derby with Hibernate?  I'm having trouble with
hibernate and insertions. My first insert works fine, but subsequent
inserts result in the following trace:

javax.servlet.ServletException: identifier of an instance of
com.ibm.orcaconf.persistant.ContactMetadata altered from 1 to 0
        com.ibm.orcaconf.ui.servlets.NewContactServlet.saveContact(NewContactServlet.java:109)
        com.ibm.orcaconf.ui.servlets.NewContactServlet.addNewContact(NewContactServlet.java:86)
        com.ibm.orcaconf.ui.servlets.NewContactServlet.handleRequest(NewContactServlet.java:39)
        com.ibm.orcaconf.ui.servlets.AbstractServlet.doPost(AbstractServlet.java:38)
        javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
        javax.servlet.http.HttpServlet.service(HttpServlet.java:802)


My Schema is as follows (I use ant to generate it):
[schemaexport] create table Contacts (
[schemaexport]     Id integer not null generated always as identity,
[schemaexport]     Email varchar(255),
[schemaexport]     Name varchar(255),
[schemaexport]     Phone varchar(255),
[schemaexport]     primary key (Id)
[schemaexport] );

My mapping looks like this:

<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
  "-//Hibernate/Hibernate Mapping DTD//EN"
  "http://hibernate.sourceforge.net/hibernate-mapping.dtd">

<hibernate-mapping>
  <class name="com.ibm.orcaconf.persistant.ContactMetadata" table="Contacts">

    <id name="id" column="Id">
      <generator class="identity"/>
    </id>

    <property name="email" column="Email"/>
    <property name="name" column="Name"/>
    <property name="phone" column="Phone"/>
  </class>
</hibernate-mapping>


Any ideas?


Much thanks,

Leo Przybylski


Mime
View raw message