facebook

MYSQL DB and Increment

  1. MyEclipse Archived
  2.  > 
  3. Database Tools (DB Explorer, Hibernate, etc.)
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #267246 Reply

    pnvsgupta
    Member

    Hi,

    I have created a table company, column ID as primary key and selected auto increment option. I have created the corresponding Java and DAO classed by using Hibernate Reverse Engineering. When I was saving data into my table company, its not getting saved.

    As select max(Id) from company returns null, So, I have inserted a row in to table manually and next time when I tried inserting into DB using my java program, it started working fine.

    So, when ever I use auto_incrment option, do I need to manually insert a row into table, so that hibernate works fine?

    Please advice.

    Thanks in advance,
    Gupta

    #267248 Reply

    Haris Peco
    Member

    Gupta,

    You have to do some DML commands (insert,update,delete) in transaction and you have to call transaction.commit() if you want that save data to database.

    See example pattern on this thread : http://myeclipseide.com/PNphpBB2+file-viewtopic-t-16377.html

    Regards,

Viewing 2 posts - 1 through 2 (of 2 total)
Reply To: MYSQL DB and Increment

You must be logged in to post in the forum log in