Matt,
       Yes, you are right it does start at 0 and increments as the
record is updated as this
link will atest:
http://www.onjava.com/pub/a/onjava/2006/09/13/dont-let-hibernate-steal-your-identity.html
Why did I not know this? For some reason I thought it inserted a 1 not
a 0. Sorry for wasting your time on this :-(

- Paul

On 3/21/07, Matt Raible <[EMAIL PROTECTED]> wrote:
I believe inserting 0 is the correct behavior.

Matt

On 3/21/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> matt:
> I turned on hibernate's show sql and when it does the insert it prints
> to the console:
> insert into contactus_message (email_message, version, date_sent,
> from_email, to_email, cc_email, email_subject, full_name) values (?,
> ?, ?, ?, ?, ?, ?, ?)
>
> my GUI is setup to only save a record I can't update, delete or view
> records from the web page.
>
>
>
> On 3/21/07, Matt Raible <[EMAIL PROTECTED]> wrote:
> > What happens if you update from the UI - do you get an error?
> >
> > Matt
> >
> > On 3/21/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> > > matt:
> > >         It gets populated with a 0.  I can't update from the UI I can
> > > only enter new records.
> > >
> > > On 3/21/07, Matt Raible <[EMAIL PROTECTED]> wrote:
> > > > Is the version field populated at all?  What if you update the record 
in the UI?
> > > >
> > > > Matt
> > > >
> > > > On 3/21/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> > > > > I saved a record from my application with Hibernate3 and the record
> > > > > gets saved in my MySQL database table the problem is the version field
> > > > > does not get populated by a 1 by hibernate.
> > > > > Why is hibernate ignoring this task?
> > > > >
> > > > >
> > > > > Here is my Table:
> > > > >
> > > > > CREATE TABLE contactus_message (
> > > > >   id BIGINT(9) UNSIGNED NOT NULL AUTO_INCREMENT,
> > > > >   version INT(11) NOT NULL,
> > > > >   full_name VARCHAR(50) NOT NULL,
> > > > >   from_email VARCHAR(50) NOT NULL,
> > > > >   cc_email VARCHAR(100) DEFAULT NULL,
> > > > >   to_email VARCHAR(50) NOT NULL,
> > > > >   email_subject VARCHAR(200) NOT NULL,
> > > > >   email_message VARCHAR(1500) NOT NULL,
> > > > >   date_sent  datetime DEFAULT NULL,
> > > > >   PRIMARY KEY  (id)
> > > > > )ENGINE=InnoDB DEFAULT CHARSET=utf8;
> > > > >
> > > > >
> > > > > field in my domain class:
> > > > > protected Integer version;
> > > > >
> > > > >
> > > > >  @Version
> > > > >  public Integer getVersion() {
> > > > >                 return version;
> > > > > }
> > > > >
> > > > > What am I doing wrong?
> > > > > --
> > > > > - Paul
> > > > >
> > > > > ---------------------------------------------------------------------
> > > > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > > > For additional commands, e-mail: [EMAIL PROTECTED]
> > > > >
> > > > >
> > > >
> > > >
> > > > --
> > > > http://raibledesigns.com
> > > >
> > > > ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > > For additional commands, e-mail: [EMAIL PROTECTED]
> > > >
> > > >
> > >
> > >
> > > --
> > > - Paul
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
> > >
> > >
> >
> >
> > --
> > http://raibledesigns.com
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
>
>
> --
> - Paul
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


--
http://raibledesigns.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




--
- Paul

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to